﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using SystemModule;

namespace M2Server
{
    public partial class TNormNpc
    {
        private void ActionOfAddNameDateList(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TStringList LoadList;
            bool boFound;
            string sListFileName;
            string sLineText;
            string sHumName = string.Empty;
            string sDate = string.Empty;
            sListFileName = M2Share.g_Config.sEnvirDir + m_sPath + QuestActionInfo.sParam1;
            LoadList = new TStringList();
            if (File.Exists(sListFileName))
            {
                try
                {
                    LoadList.LoadFromFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件读取失败.... => " + sListFileName);
                }
            }
            try
            {
                boFound = false;
                if (LoadList.Count > 0)
                {
                    for (int i = 0; i < LoadList.Count; i++)
                    {
                        sLineText = LoadList[i].Trim();
                        sLineText = HUtil32.GetValidStr3(sLineText, ref sHumName, new string[] { " ", "\09" });
                        sLineText = HUtil32.GetValidStr3(sLineText, ref sDate, new string[] { " ", "\09" });
                        if ((sHumName).ToLower().CompareTo((PlayObject.m_sCharName).ToLower()) == 0)
                        {
                            LoadList[i] = PlayObject.m_sCharName + "\09" + (DateTime.Today).ToString();
                            boFound = true;
                            break;
                        }
                    }
                }
                if (!boFound)
                {
                    //LoadList.Add(PlayObject.m_sCharName + "\09" + (DateTime.Today).ToString());
                }
                LoadList.SaveToFile(sListFileName);
            }
            catch
            {
                M2Share.MainOutMessage("文件保存失败 => " + sListFileName);
            }
            Dispose(LoadList);
        }

        private void ActionOfDelNameDateList(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TStringList LoadList;
            string sLineText;
            string sListFileName;
            string sHumName = string.Empty;
            string sDate = string.Empty;
            bool boFound;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            sListFileName = M2Share.g_Config.sEnvirDir + m_sPath + QuestActionInfo.sParam1;
            LoadList = new TStringList();
            if (File.Exists(sListFileName))
            {
                try
                {
                    LoadList.LoadFromFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件读取失败.... => " + sListFileName);

                    return;
                }
            }
            boFound = false;
            if (LoadList.Count > 0)
            {
                for (int i = 0; i < LoadList.Count; i++)
                {
                    sLineText = LoadList[i].Trim();
                    sLineText = HUtil32.GetValidStr3(sLineText, ref sHumName, new string[] { " ", "\09" });
                    sLineText = HUtil32.GetValidStr3(sLineText, ref sDate, new string[] { " ", "\09" });
                    if ((sHumName).ToLower().CompareTo((PlayObject.m_sCharName).ToLower()) == 0)
                    {
                        LoadList.RemoveAt(i);
                        boFound = true;
                        break;
                    }
                }
            }
            if (boFound)
            {
                try
                {
                    LoadList.SaveToFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件保存失败  => " + sListFileName);
                }
            }
            Dispose(LoadList);
            LoadList.Dispose();
        }

        /// <summary>
        /// 功能：脚本增加技能。
        /// 格式：ADDSKILL 技能名称 技能等级 HERO  (加参数HERO,即是增加英雄技能)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfAddSkill(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TMagic Magic;
            TUserMagic UserMagic = null;
            int nLevel;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nLevel = HUtil32._MIN(3, HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0));
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ADDSKILL);
                        return;
                    }
                    Magic = M2Share.UserEngine.FindHeroMagic(QuestActionInfo.sParam1);
                    if (Magic != null)
                    {
                        if (PlayObject.m_MyHero != null)
                        {
                            if (!PlayObject.m_MyHero.IsTrainingSkill(Magic.wMagicId))
                            {
                                if ((Magic.sDescr == "内功") &&
                                    (!((THeroObject)(PlayObject.m_MyHero)).m_boTrainingNG)) // 没有内功心法,则不能学内功技能
                                {
                                    return;
                                }
                                if (Magic.sDescr == "连击")
                                {
                                    ((THeroObject)(PlayObject.m_MyHero)).m_boCanUseBatter = true;
                                }
                                UserMagic.MagicInfo = Magic;
                                UserMagic.wMagIdx = Magic.wMagicId;
                                UserMagic.btKey = 0;
                                UserMagic.btLevel = (byte)nLevel;
                                UserMagic.nTranPoint = 0;
                                PlayObject.m_MyHero.m_MagicList.Add(UserMagic);
                                ((THeroObject)(PlayObject.m_MyHero)).SendAddMagic(UserMagic);
                                ((THeroObject)(PlayObject.m_MyHero)).RecalcAbilitys();
                                PlayObject.m_MyHero.CompareSuitItem(false);//套装
                                PlayObject.HeroAddSkillFunc(Magic.wMagicId);// 英雄学技能触发 
                                if (M2Share.g_Config.boShowScriptActionMsg)
                                {
                                    ((THeroObject)(PlayObject.m_MyHero)).SysMsg("[英雄] " + Magic.sMagicName + "练习成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                                }
                            }
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ADDSKILL);
                    }
                }
                else
                {
                    Magic = M2Share.UserEngine.FindMagic(QuestActionInfo.sParam1);
                    if (Magic != null)
                    {
                        if (!PlayObject.IsTrainingSkill(Magic.wMagicId))
                        {
                            if ((Magic.sDescr == "内功") && (!PlayObject.m_boTrainingNG)) // 没有内功心法,则不能学内功技能
                            {
                                return;
                            }
                            if (Magic.sDescr == "连击")
                            {
                                PlayObject.m_boCanUseBatter = true;
                            }
                            UserMagic.MagicInfo = Magic;
                            UserMagic.wMagIdx = Magic.wMagicId;
                            UserMagic.btKey = 0;
                            UserMagic.btLevel = (byte)nLevel;
                            UserMagic.nTranPoint = 0;
                            PlayObject.m_MagicList.Add(UserMagic);
                            PlayObject.SendAddMagic(UserMagic);
                            PlayObject.RecalcAbilitys();
                            PlayObject.CompareSuitItem(false);// 套装
                            PlayObject.AddSkillFunc(Magic.wMagicId);// 人物学技能触发 
                            if (M2Share.g_Config.boShowScriptActionMsg)
                            {
                                PlayObject.SysMsg(Magic.sMagicName + "练习成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ADDSKILL);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfAddSkill");
            }
        }

        /// <summary>
        /// 功能：添加行会成员
        /// 格式：ADDGUILDMEMBER 行会名称 人物名称
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfADDGUILDMEMBER(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sGuildName;
            string UserName;
            TGUild Guild;
            TPlayObject PlayHum;
            try
            {
                sGuildName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                UserName = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);
                if ((sGuildName == "") || (UserName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ADDGUILDMEMBER);
                    return;
                }
                PlayHum = M2Share.UserEngine.GetPlayObject(UserName);
                Guild = M2Share.g_GuildManager.FindGuild(sGuildName);
                if (Guild != null)
                {
                    if ((PlayHum != null) && (!PlayHum.m_boNotOnlineAddExp))// 人物存在,不是离线挂机,允许加入行会
                    {
                        if (!Guild.IsMember(UserName))// 不是行会成员
                        {
                            if ((PlayHum.m_MyGuild == null) && (Guild.m_RankList.Count < Guild.GuildMemberCount))// 人物没有行会,并且要加入的行会人员没有满
                            {
                                Guild.AddMember(PlayHum);
                                M2Share.UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, Guild.sGuildName);
                                PlayHum.m_MyGuild = Guild;
                                PlayHum.m_sGuildRankName = Guild.GetRankName(PlayHum, ref PlayHum.m_nGuildRankNo);
                                PlayHum.RefShowName();
                                PlayHum.SysMsg("您已加入行会: " + Guild.sGuildName + " 当前封号为: " + PlayHum.m_sGuildRankName, TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                        }
                    }
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ADDGUILDMEMBER);
                    return;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfADDGUILDMEMBER");
            }
        }

        /// <summary>
        /// 功能：删除行会成员（删除掌门无效
        /// 格式：DELGUILDMEMBER 行会名称 人物名称
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfDelGuildMember(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sGuildName;
            string UserName;
            TGUild Guild;
            TPlayObject PlayHum;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sGuildName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                UserName = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);
                if ((sGuildName == "") || (UserName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_DELGUILDMEMBER);
                    return;
                }
                PlayHum = M2Share.UserEngine.GetPlayObject(UserName);
                Guild = M2Share.g_GuildManager.FindGuild(sGuildName);
                if (Guild != null)
                {
                    if ((PlayHum != null) && (!PlayHum.m_boNotOnlineAddExp))// 人物存在,不是离线挂机,允许加入行会
                    {
                        if (Guild.IsMember(UserName) && (PlayHum.m_nGuildRankNo != 1))// 是行会成员
                        {
                            if (Guild.DelMember(UserName))//从行会中删除
                            {
                                PlayHum.m_MyGuild = null;
                                PlayHum.RefRankInfo(0, "");
                                PlayHum.RefShowName();
                                M2Share.UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, Guild.sGuildName);
                            }
                        }
                    }
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_DELGUILDMEMBER);
                    return;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfDELGUILDMEMBER");
            }
        }

        private void ActionOfAutoAddGameGold(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo, int nPoint, int nTime)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("START").ToLower()) == 0)
                {
                    if ((nPoint > 0) && (nTime > 0))
                    {
                        PlayObject.m_nIncGameGold = nPoint;
                        PlayObject.m_dwIncGameGoldTime = ((uint)nTime * 1000);

                        PlayObject.m_dwIncGameGoldTick = HUtil32.GetTickCount();
                        PlayObject.m_boIncGameGold = true;
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("STOP").ToLower()) == 0)
                {
                    PlayObject.m_boIncGameGold = false;
                    return;
                }
                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_AUTOADDGAMEGOLD);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfAutoAddGameGold");
            }
        }

        /// <summary>
        /// SETAUTOGETEXP 时间 点数 是否安全区 地图号
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfAutoGetExp(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nTime;
            int nPoint;
            bool boIsSafeZone;
            string sMAP;
            Envirnoment Envir;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Envir = null;
                nTime = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                nPoint = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                boIsSafeZone = QuestActionInfo.sParam3[1] == '1';
                sMAP = QuestActionInfo.sParam4;
                if (sMAP != "")
                {
                    Envir = M2Share.g_MapManager.FindMap(sMAP);
                }
                if ((nTime <= 0) || (nPoint <= 0) || ((sMAP != "") && (Envir == null)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SETAUTOGETEXP);
                    return;
                }
                PlayObject.m_boAutoGetExpInSafeZone = boIsSafeZone;
                PlayObject.m_AutoGetExpEnvir = Envir;
                PlayObject.m_nAutoGetExpTime = nTime * 1000;
                PlayObject.m_nAutoGetExpPoint = nPoint;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfAutoGetExp");
            }
        }

        private void ActionOfAutoSubGameGold(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo, int nPoint, int nTime)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("START").ToLower()) == 0)
                {
                    if ((nPoint > 0) && (nTime > 0))
                    {
                        PlayObject.m_nDecGameGold = nPoint;
                        PlayObject.m_dwDecGameGoldTime = ((uint)nTime * 1000);
                        PlayObject.m_dwDecGameGoldTick = 0;
                        PlayObject.m_boDecGameGold = true;
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("STOP").ToLower()) == 0)
                {
                    PlayObject.m_boDecGameGold = false;
                    return;
                }
                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_AUTOSUBGAMEGOLD);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfAutoSubGameGold");
            }
        }

        /// <summary>
        /// 功能:记路标石 
        /// 格式:TAGMAPINFO 记路(1-6)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfTAGMAPINFO(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nTpye;
            IniFile IniFile;
            string sFileName;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nTpye = (byte)QuestActionInfo.nParam1;
                if ((nTpye <= 0) || (nTpye > 6))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_TAGMAPINFO);
                    return;
                }
                PlayObject.m_TagMapInfos[nTpye].TagMapName = PlayObject.m_sMapName;
                PlayObject.m_TagMapInfos[nTpye].TagX = PlayObject.m_nCurrX;
                PlayObject.m_TagMapInfos[nTpye].TagY = PlayObject.m_nCurrY;// 保存到文件里
                sFileName = M2Share.g_Config.sEnvirDir + "UserData";
                if (!Directory.Exists(sFileName))
                {
                    Directory.CreateDirectory(sFileName); // 目录不存在,则创建
                }
                sFileName = sFileName + "\\HumRecallPoint.txt";
                IniFile = new IniFile(sFileName);
                try
                {
                    for (var i = 1; i <= 6; i++)
                    {
                        IniFile.WriteString(PlayObject.m_sCharName, "记录" + (i).ToString(), PlayObject.m_TagMapInfos[i].TagMapName + ","
                            + (PlayObject.m_TagMapInfos[i].TagX).ToString() + "," + (PlayObject.m_TagMapInfos[i].TagY).ToString());
                    }
                }
                finally
                {
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfTAGMAPINFO");
            }
        }

        /// <summary>
        /// 功能:移动到记路标石记录的地图XY
        /// 格式: TAGMAPMOVE 记路(1-6)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfTAGMAPMOVE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nTpye;
            Envirnoment Envir;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nTpye = (byte)QuestActionInfo.nParam1;
                if ((nTpye <= 0) || (nTpye > 6))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_TAGMAPMOVE);
                    return;
                }
                if ((PlayObject.m_TagMapInfos[nTpye].TagX != 0) || (PlayObject.m_TagMapInfos[nTpye].TagY != 0))
                {
                    Envir = M2Share.g_MapManager.FindMap(PlayObject.m_TagMapInfos[nTpye].TagMapName);
                    if (Envir != null)
                    {
                        if (Envir.CanWalk(PlayObject.m_TagMapInfos[nTpye].TagX, PlayObject.m_TagMapInfos[nTpye].TagY, true))
                        {
                            PlayObject.SpaceMove(PlayObject.m_TagMapInfos[nTpye].TagMapName, PlayObject.m_TagMapInfos[nTpye].TagX, PlayObject.m_TagMapInfos[nTpye].TagY, 0);
                        }
                        else
                        {
                            PlayObject.SysMsg(string.Format(GameMsgDef.g_sGameCommandPositionMoveCanotMoveToMap1, PlayObject.m_TagMapInfos[nTpye].TagMapName,
                                PlayObject.m_TagMapInfos[nTpye].TagX, PlayObject.m_TagMapInfos[nTpye].TagY), TMsgColor.c_Green, TMsgType.t_Hint);
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfTAGMAPMOVE");
            }
        }

        /// <summary>
        /// 功能：调整行会成员上限
        /// 格式：CHANGEGUILDMEMBERCOUNT +\-\= 人数(65535)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCHANGEGUILDMEMBERCOUNT(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nMemberCount;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nMemberCount = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nMemberCount < 0) || (nMemberCount > 65535))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEGUILDMEMBERCOUNT);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                if (PlayObject.m_MyGuild != null)
                {
                    switch (cMethod)
                    {
                        case '=':
                            if (nMemberCount >= 0)
                            {
                                PlayObject.m_MyGuild.GuildMemberCount = (ushort)nMemberCount;
                                PlayObject.m_MyGuild.SaveGuildInfoFile();// 保存行会文件
                            }
                            break;
                        case '-':
                            if (PlayObject.m_MyGuild.GuildMemberCount > nMemberCount)
                            {
                                PlayObject.m_MyGuild.m_nGuildFountain -= nMemberCount;
                            }
                            else
                            {
                                PlayObject.m_MyGuild.GuildMemberCount = 0;
                            }
                            PlayObject.m_MyGuild.SaveGuildInfoFile(); // 保存行会文件
                            break;
                        case '+':
                            if (PlayObject.m_MyGuild.GuildMemberCount + nMemberCount > ushort.MaxValue)
                            {
                                PlayObject.m_MyGuild.GuildMemberCount = ushort.MaxValue;
                            }
                            else
                            {
                                PlayObject.m_MyGuild.GuildMemberCount += (ushort)nMemberCount;
                            }
                            PlayObject.m_MyGuild.SaveGuildInfoFile();// 保存行会文件
                            break;
                        default:
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEGUILDMEMBERCOUNT);
                            return;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCHANGEGUILDMEMBERCOUNT");
            }
        }

        /// <summary>
        /// 功能：行会酒泉数据的调整
        /// 格式：CHANGEGUILDFOUNTAIN +\-\= 点数
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCHANGEGUILDFOUNTAIN(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nPoint;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nPoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nPoint < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEGUILDFOUNTAIN);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                if (PlayObject.m_MyGuild != null)
                {
                    switch (cMethod)
                    {
                        case '=':
                            if (nPoint >= 0)
                            {
                                PlayObject.m_MyGuild.m_nGuildFountain = nPoint;
                                PlayObject.m_MyGuild.SaveGuildInfoFile();// 保存行会文件
                            }
                            break;
                        case '-':
                            if (PlayObject.m_MyGuild.m_nGuildFountain > nPoint)
                            {
                                PlayObject.m_MyGuild.m_nGuildFountain -= nPoint;
                            }
                            else
                            {
                                PlayObject.m_MyGuild.m_nGuildFountain = 0;
                            }
                            PlayObject.m_MyGuild.SaveGuildInfoFile();
                            break;
                        case '+':// 保存行会文件
                            PlayObject.m_MyGuild.m_nGuildFountain += nPoint;
                            PlayObject.m_MyGuild.SaveGuildInfoFile();
                            break;
                        default:
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEGUILDFOUNTAIN);
                            return;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCHANGEGUILDFOUNTAIN");
            }
        }

        /// <summary>
        /// 功能：调整声望
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeCreditPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nCreditPoint;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nCreditPoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nCreditPoint < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nCreditPoint)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CREDITPOINT);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (nCreditPoint >= 0)
                        {
                            PlayObject.m_btCreditPoint = (UInt16)nCreditPoint;
                        }
                        break;
                    case '-':
                        if (PlayObject.m_btCreditPoint > nCreditPoint)
                        {
                            PlayObject.m_btCreditPoint -= (UInt16)nCreditPoint;
                        }
                        else
                        {
                            PlayObject.m_btCreditPoint = 0;
                        }
                        break;
                    case '+':
                        PlayObject.m_btCreditPoint += (UInt16)nCreditPoint;
                        break;
                    default:
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CREDITPOINT);
                        return;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeCreditPoint");
            }
        }

        /// <summary>
        /// 功能：调整荣誉值
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeCreditGlory(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGameGlory;
            int nOldGameGlory;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nOldGameGlory = PlayObject.m_btGameGlory;
                nGameGlory = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nGameGlory < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nGameGlory)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GAMEGLORY);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if ((nGameGlory >= 0))
                        {
                            PlayObject.m_btGameGlory = (byte)nGameGlory;
                        }
                        break;
                    case '-':
                        PlayObject.m_btGameGlory = (byte)HUtil32._MAX(0, PlayObject.m_btGameGlory - nGameGlory);
                        break;
                    case '+':
                        PlayObject.m_btGameGlory = (byte)HUtil32._MIN(Byte.MaxValue, PlayObject.m_btGameGlory + nGameGlory);
                        break;
                }
                if (M2Share.g_boGameLogGameGlory)
                {
                    M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GameGlory, PlayObject.m_sMapName,
                        PlayObject.m_nCurrX, PlayObject.m_nCurrY, PlayObject.m_sCharName, M2Share.g_Config.sGameGlory, PlayObject.m_btGameGlory, cMethod
                        + "(" + (nGameGlory).ToString() + ")", this.m_sCharName));
                }
                if (nOldGameGlory != PlayObject.m_btGameGlory)
                {
                    PlayObject.GameGloryChanged();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeCreditGlory");
            }
        }

        /// <summary>
        /// 功能：调整经验 英雄存在,则按比配分经验给英雄
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeExp(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nExp;
            char cMethod;
            int dwInt;
            byte nCode;
            nCode = 0;
            try
            {
                // ----------------------------------------------------------------------------------------
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                // ======================================================================
                if (PlayObject == null)
                {
                    return;
                }
                nCode = 1;
                nExp = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nExp < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEEXP);
                    return;
                }
                nCode = 2;
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        nCode = 3;
                        if (nExp >= 0)
                        {
                            if (PlayObject.m_Abil.Level < M2Share.g_Config.nLimitExpLevel)  // 是否超过限制等级
                            {
                                nCode = 4;
                                PlayObject.m_Abil.Exp = nExp;
                            }
                            else
                            {
                                nCode = 5;
                                PlayObject.m_Abil.Exp = M2Share.g_Config.nLimitExpValue;
                            }
                        }
                        break;
                    case '-':
                        nCode = 6;
                        if (PlayObject.m_Abil.Exp > nExp)
                        {
                            nCode = 7;
                            PlayObject.m_Abil.Exp -= nExp;
                        }
                        else
                        {
                            nCode = 8;
                            PlayObject.m_Abil.Exp = 0;
                        }
                        break;
                    case '+':
                        nCode = 9;
                        if (PlayObject.m_Abil.Level < M2Share.g_Config.nLimitExpLevel) // 是否超过限制等级
                        {
                            nCode = 10;
                            dwInt = nExp;
                            if (PlayObject.m_Abil.Exp >= nExp)
                            {
                                if ((int.MaxValue - PlayObject.m_Abil.Exp) < nExp)
                                {
                                    dwInt = int.MaxValue - PlayObject.m_Abil.Exp;
                                }
                            }
                            else
                            {
                                if ((int.MaxValue - nExp) < PlayObject.m_Abil.Exp)
                                {
                                    dwInt = int.MaxValue - nExp;
                                }
                            }
                        }
                        else
                        {
                            dwInt = M2Share.g_Config.nLimitExpValue;
                        }
                        nCode = 11;
                        PlayObject.GetExpToItem(dwInt);
                        nCode = 12;
                        if (PlayObject.m_MyHero != null)
                        {
                            nCode = 13;
                            ((THeroObject)(PlayObject.m_MyHero)).GetExp((int)Math.Abs(HUtil32.Round((double)(M2Share.g_Config.nHeroNoKillMonExpRate / 100) * dwInt)));
                            nCode = 14;
                            dwInt = (int)Math.Abs(HUtil32.Round((double)((100 - M2Share.g_Config.nHeroNoKillMonExpRate) / 100) * dwInt));
                        }
                        nCode = 15;
                        PlayObject.m_GetExp = dwInt;// 人物取得的经验,$GetExp变量使用
                        if (M2Share.g_FunctionNPC != null)
                        {
                            M2Share.g_FunctionNPC.GotoLable(PlayObject, "@GetExp", false); // 取经验触发
                        }
                        PlayObject.m_Abil.Exp += dwInt;
                        PlayObject.SendMsg(PlayObject, Grobal2.RM_WINEXP, 0, (int)dwInt, 0, 0, "");
                        PlayObject.GetExpToCrystal(dwInt, 0);// 取经验到天地结晶中
                        nCode = 16;
                        if (PlayObject.m_Abil.Exp >= PlayObject.m_Abil.MaxExp)
                        {
                            PlayObject.m_Abil.Exp -= PlayObject.m_Abil.MaxExp;
                            nCode = 17;
                            if ((PlayObject.m_Abil.Level < M2Share.MAXUPLEVEL) && (PlayObject.m_Abil.Level < M2Share.g_Config.nLimitExpLevel))
                            {
                                PlayObject.m_Abil.Level++;
                            }
                            // 增加限制等级
                            if (PlayObject.m_Abil.Level < M2Share.g_Config.nLimitExpLevel)
                            {
                                PlayObject.HasLevelUp(PlayObject.m_Abil.Level - 1);
                            }
                            // 增加限制等级
                            // 人物升级记录日志
                            M2Share.AddGameDataLog("12" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_Abil.Level).ToString()
                                + "\09" + (PlayObject.m_Abil.Exp).ToString() + "/" + (PlayObject.m_Abil.MaxExp).ToString() + "\09" + this.m_sCharName
                                + "\09" + "0" + "\09" + "0" + "\09" + "1" + "\09" + "(调整经验)");
                        }
                        nCode = 18;
                        if (PlayObject.m_MagicArr[0][MagicConst.SKILL_68] != null)
                        {
                            // 学过酒气护体
                            if (PlayObject.m_MagicArr[0][MagicConst.SKILL_68].btLevel < 100)
                            {
                                PlayObject.m_Exp68 += (UInt16)dwInt;
                            }
                            nCode = 19;
                            if (PlayObject.m_Exp68 >= PlayObject.m_MaxExp68)
                            {
                                // 超过升级经验,则升级技能
                                PlayObject.m_Exp68 -= PlayObject.m_MaxExp68;
                                nCode = 20;
                                if (PlayObject.m_MagicArr[0][MagicConst.SKILL_68].btLevel < 100)
                                {
                                    PlayObject.m_MagicArr[0][MagicConst.SKILL_68].btLevel++;
                                }
                                PlayObject.m_MaxExp68 = (UInt16)PlayObject.GetSkill68Exp(PlayObject.m_MagicArr[0][MagicConst.SKILL_68].btLevel);
                                PlayObject.SendDelayMsg(PlayObject, Grobal2.RM_MAGIC_LVEXP, 0, PlayObject.m_MagicArr[0][MagicConst.SKILL_68].MagicInfo.wMagicId, PlayObject.m_MagicArr[0][MagicConst.SKILL_68].btLevel, PlayObject.m_MagicArr[0][MagicConst.SKILL_68].nTranPoint, "", 100);
                            }
                            nCode = 21;
                            if (PlayObject.m_MagicArr[0][MagicConst.SKILL_68].btLevel < 100)
                            {
                                //PlayObject.SendMsg(PlayObject, Grobal2.Rm_MagicArr[0][MagicConst.SKILL_68]EXP, 0, 0, 0, 0, EDcode.Units.EDcode.EncodeString((PlayObject.m_Exp68).ToString() + "/" + (PlayObject.m_MaxExp68).ToString()));
                            }
                            // 发送酒气护体经验
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeExp Code:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 功能:调整内功经验 
        /// 格式:CHANGENGEXP 控制符(=,+,-) 经验点数 Hero
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeNGExp(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nExp;
            char cMethod;
            int dwInt;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nExp = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nExp < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGENGEXP);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        if (!((THeroObject)(PlayObject.m_MyHero)).m_boTrainingNG)
                        {
                            return;
                        }
                        switch (cMethod)
                        {
                            case '=':
                                if (nExp >= 0)
                                {
                                    ((THeroObject)(PlayObject.m_MyHero)).m_ExpSkill69 = nExp;
                                }
                                PlayObject.m_MyHero.SendNGData();
                                break;
                            case '-':// 发送内功数据
                                if (((THeroObject)(PlayObject.m_MyHero)).m_ExpSkill69 > nExp)
                                {
                                    ((THeroObject)(PlayObject.m_MyHero)).m_ExpSkill69 -= nExp;
                                }
                                else
                                {
                                    ((THeroObject)(PlayObject.m_MyHero)).m_ExpSkill69 = 0;
                                }
                                PlayObject.m_MyHero.SendNGData();
                                break;
                            case '+':// 发送内功数据
                                dwInt = nExp;
                                ((THeroObject)(PlayObject.m_MyHero)).GetNGExp(dwInt, 1);
                                break;
                        }
                    }
                }
                else
                {
                    if (!PlayObject.m_boTrainingNG)
                    {
                        return;
                    }
                    switch (cMethod)
                    {
                        case '=':
                            if (nExp >= 0)
                            {
                                PlayObject.m_ExpSkill69 = nExp;
                            }
                            PlayObject.SendNGData();
                            break;
                        case '-':// 发送内功数据
                            if (PlayObject.m_ExpSkill69 > nExp)
                            {
                                PlayObject.m_ExpSkill69 -= nExp;
                            }
                            else
                            {
                                PlayObject.m_ExpSkill69 = 0;
                            }
                            PlayObject.SendNGData();
                            break;
                        case '+':// 发送内功数据
                            dwInt = nExp;
                            PlayObject.GetNGExp(dwInt, 1);
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeNGExp");
            }
        }

        /// <summary>
        /// 调整内功经验 
        /// 功能:调整人物内力等级 
        /// 格式:CHANGENGLEVEL 控制符(=,+,-) 等级数(1-255) Hero
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCHANGENGLEVEL(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nLv;
            byte nLEVEL;
            bool boChgOK;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                boChgOK = false;
                nLEVEL = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nLEVEL < 0) || (nLEVEL > 255))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGENGLEVEL);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        if (!((THeroObject)(PlayObject.m_MyHero)).m_boTrainingNG)
                        {
                            return;
                        }
                        switch (cMethod)
                        {
                            case '=':
                                if ((nLEVEL > 0) && (nLEVEL <= 255))
                                {
                                    ((THeroObject)(PlayObject.m_MyHero)).m_NGLevel = nLEVEL;
                                    boChgOK = true;
                                }
                                break;
                            case '-':
                                nLv = (byte)HUtil32._MAX(0, ((THeroObject)(PlayObject.m_MyHero)).m_NGLevel - nLEVEL);
                                ((THeroObject)(PlayObject.m_MyHero)).m_NGLevel = nLv;
                                boChgOK = true;
                                break;
                            case '+':
                                nLv = (byte)HUtil32._MIN(255, ((THeroObject)(PlayObject.m_MyHero)).m_NGLevel + nLEVEL);
                                ((THeroObject)(PlayObject.m_MyHero)).m_NGLevel = nLv;
                                boChgOK = true;
                                break;
                        }
                        if (boChgOK)
                        {
                            PlayObject.m_MyHero.SendNGData();// 发送内功数据
                            // 等级调整记录日志
                            M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_MyHero.m_sMapName + "\09" + (PlayObject.m_MyHero.m_nCurrX).ToString()
                                + "\09" + (PlayObject.m_MyHero.m_nCurrY).ToString() + "\09" + PlayObject.m_MyHero.m_sCharName + "\09"
                                + (((THeroObject)(PlayObject.m_MyHero)).m_NGLevel).ToString() + "\09" + "英雄内功" + "\09" + cMethod + "(" + (nLEVEL).ToString()
                                + ")" + "\09" + this.m_sCharName);
                        }
                    }
                }
                else
                {
                    if (!PlayObject.m_boTrainingNG)
                    {
                        return;
                    }
                    switch (cMethod)
                    {
                        case '=':
                            if ((nLEVEL > 0) && (nLEVEL <= 255))
                            {
                                PlayObject.m_NGLevel = nLEVEL;
                                boChgOK = true;
                            }
                            break;
                        case '-':
                            nLv = (byte)HUtil32._MAX(0, PlayObject.m_NGLevel - nLEVEL);
                            PlayObject.m_NGLevel = nLv;
                            boChgOK = true;
                            break;
                        case '+':
                            nLv = (byte)HUtil32._MIN(255, PlayObject.m_NGLevel + nLEVEL);
                            PlayObject.m_NGLevel = nLv;
                            boChgOK = true;
                            break;
                    }
                    if (boChgOK)
                    {
                        PlayObject.SendNGData();// 发送内功数据
                        // 等级调整记录日志
                        M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09"
                            + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + (PlayObject.m_NGLevel).ToString()
                            + "\09" + "内功" + "\09" + cMethod + "(" + (nLEVEL).ToString() + ")" + "\09" + this.m_sCharName);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCHANGENGLEVEL");
            }
        }

        /// <summary>
        /// 调整内功等级
        /// 功能：客户端显示天地结晶图标
        /// 格式：OPENEXPCRYSTAL
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfOPENEXPCRYSTAL(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.m_boShowExpCrystal = true;// 是否显示天地结晶图标 
                PlayObject.m_CrystalLevel = 1;// 天地结晶等级 
                PlayObject.m_CrystalExp = 0;// 天地结晶当前经验 
                PlayObject.m_CrystalMaxExp = 0;// 天地结晶升级经验 
                PlayObject.m_CrystalNGExp = 0;// 天地结晶当前内功经验 
                PlayObject.m_CrystalNGMaxExp = 0;// 天地结晶内功升级经验 
                PlayObject.m_boGetExpCrystalExp = false;// 是否可以提取经验 
                PlayObject.m_nGetCrystalExp = 0;// 可提取天地结晶经验 
                PlayObject.m_nGetCrystalNGExp = 0;// 天可提取地结晶内功经验 
                PlayObject.SendMsg(PlayObject, Grobal2.RM_OPENEXPCRYSTAL, 0, 2, 0, 0, "");// 发消息显示天地结晶图标
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfOPENEXPCRYSTAL");
            }
        }

        /// <summary>
        /// 客户端显示天地结晶
        /// 功能：客户端关闭天地结晶图标
        /// 格式：CLOSEEXPCRYSTAL
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCLOSEEXPCRYSTAL(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.m_boShowExpCrystal)
                {
                    PlayObject.m_boShowExpCrystal = false;// 是否显示天地结晶图标 
                    PlayObject.m_CrystalLevel = 1;// 天地结晶等级 
                    PlayObject.m_CrystalExp = 0;// 天地结晶当前经验 
                    PlayObject.m_CrystalMaxExp = 0;// 天地结晶升级经验 
                    PlayObject.m_CrystalNGExp = 0;// 天地结晶当前内功经验 
                    PlayObject.m_CrystalNGMaxExp = 0;// 天地结晶内功升级经验 
                    PlayObject.m_boGetExpCrystalExp = false;// 是否可以提取经验 
                    PlayObject.m_nGetCrystalExp = 0;// 可提取天地结晶经验 
                    PlayObject.m_nGetCrystalNGExp = 0;// 天可提取地结晶内功经验 
                    PlayObject.SendMsg(PlayObject, Grobal2.RM_OPENEXPCRYSTAL, 0, 1, 0, 0, "");// 发消息关闭天地结晶图标
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCLOSEEXPCRYSTAL");
            }
        }

        /// <summary>
        /// 客户端关闭天地结晶
        /// 功能：取提天地结晶中的经验(只提取可提取的经验)
        /// 格式：GETEXPTOCRYSTAL
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGETEXPTOCRYSTAL(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.ClientGetExpTCrystal();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGETEXPTOCRYSTAL");
            }
        }

        /// <summary>
        /// 取提天地结晶中的经验(只提取可提取的经验)
        /// 功能：时间到触发QF段
        /// 格式：SENDTIMEMSG 消息内容 时间 字颜色 QF触发段
        /// 例：SENDTIMEMSG 火龙殿任务还剩%s秒结束... 300 251 @触发测试
        /// 说明：300代表时间(秒)  251代表颜色 @触发测试 触发QFunction-0.txt
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        /// </summary>
        private void ActionOfSENDTIMEMSG(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nTime;
            byte FColor;
            string sQFStr;
            string sMsg;
            bool boForMapShowHint;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sMsg = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                nTime = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);// 时间(秒)
                FColor = (byte)HUtil32._MIN(255, HUtil32.Str_ToInt(QuestActionInfo.sParam3, 0));// 字颜色
                sQFStr = GetLineVariableText(PlayObject, QuestActionInfo.sParam4);// 触发QFunction-0.txt段
                boForMapShowHint = HUtil32.Str_ToInt(QuestActionInfo.sParam5, 0) != 0;// 换地图是否还显示倒计时信息
                if ((sMsg == "") || (sQFStr == "") || (nTime < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SENDTIMEMSG);
                    return;
                }

                PlayObject.m_dwUserTick[0] = (uint)nTime;// 设置人物的时间
                PlayObject.m_sMapQFStr = sQFStr;// SENDTIMEMSG命令设置的触发段 
                PlayObject.m_boForMapShowHint = boForMapShowHint;// 换地图是否还显示倒计时信息 
                PlayObject.m_dwUserTick[3] = 0;// 发送显示信息给客户端
                PlayObject.SendMsg(PlayObject, Grobal2.RM_MOVEMESSAGE, 2, FColor, 0, nTime, sMsg);// 客户端显示倒计时(快捷键上方显示) 倒记时消息
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSENDTIMEMSG");
            }
        }

        /// <summary>
        /// 时间到触发QF段(客户端显示信息)
        /// 功能：时间到后进入QFunction-0.txt 指定的触发段,发消息给客户端显示'!'号图标
        /// 格式：SENDMSGWINDOWS 时间  QF解发段
        /// 例：  SENDMSGWINDOWS 300 @提示窗的触发
        /// 说明：300代表时间(秒)  @提示窗的触发 触发QFunction-0.txt
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        /// </summary>
        private void ActionOfSENDMSGWINDOWS(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nTime;
            string sQFStr;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nTime = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), -1);// 时间(秒)
                sQFStr = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);// 触发QFunction-0.txt段
                if ((sQFStr == "") || (nTime < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SENDMSGWINDOWS);
                    return;
                }
                PlayObject.m_dwUserTick[2] = (uint)nTime;// 设置人物的时间
                PlayObject.m_sMapQFStr1 = sQFStr;// SENDMSGWINDOWS命令设置的触发段
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSENDMSGWINDOWS");
            }
        }

        /// <summary>
        /// 时间到触发QF段
        /// 功能：关闭客户端'!'图标的显示
        /// 格式：CLOSEMSGWINDOWS
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCLOSEMSGWINDOWS(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            PlayObject.SendMsg(PlayObject, Grobal2.RM_HIDESIGHICON, 0, 0, 0, 0, "");// 发消息给客户端关闭图标的显示
        }

        /// <summary>
        /// 关闭客户端'!'图标的显示
        /// 功能：取组队成员数
        /// 格式：GETGROUPCOUNT 变量
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGETGROUPCOUNT(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGroupCount = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((PlayObject.m_GroupOwner != null)) // 有组队
                {
                    if (PlayObject.m_GroupOwner.m_GroupMembers.Count > 0)
                    {
                        nGroupCount = PlayObject.m_GroupOwner.m_GroupMembers.Count;
                    }
                }
                ScriptBase.SetValValue(PlayObject, QuestActionInfo.sParam1, nGroupCount);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGETGROUPCOUNT");
            }
        }

        /// <summary>
        /// 功能: 改变发型
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeHairStyle(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nHair;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nHair = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                if ((QuestActionInfo.sParam1 != "") && (nHair >= 0))
                {
                    PlayObject.m_btHair = (byte)nHair;
                    PlayObject.FeatureChanged();
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_HAIRSTYLE);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeHairStyle");
            }
        }

        /// <summary>
        /// 功能: 改变职业
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeJob(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nJob;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nJob = -1;
                if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "WARRIOR", 3))
                {
                    nJob = 0;
                }
                if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "WIZARD", 3))
                {
                    nJob = 1;
                }
                if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "TAOIST", 3))
                {
                    nJob = 2;
                }
                if (nJob < 0)
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEJOB);
                    return;
                }
                if (PlayObject.m_btJob != nJob)
                {
                    PlayObject.m_btJob = (byte)nJob;
                    PlayObject.HasLevelUp(0);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeJob");
            }
        }

        /// <summary>
        /// 功能: 改变等级
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeLevel(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            bool boChgOK;
            int nLevel;
            int nLv;
            int nOldLevel;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                boChgOK = false;
                nOldLevel = PlayObject.m_Abil.Level;
                nLevel = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                if ((nLevel < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nLevel)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGELEVEL);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if ((nLevel > 0) && (nLevel <= M2Share.MAXLEVEL))
                        {
                            PlayObject.m_Abil.Level = (ushort)nLevel;
                            PlayObject.HasLevelUp(1);
                            boChgOK = true;
                        }
                        break;
                    case '-':
                        nLv = HUtil32._MAX(0, PlayObject.m_Abil.Level - nLevel);
                        nLv = HUtil32._MIN(M2Share.MAXLEVEL, nLv);
                        PlayObject.m_Abil.Level = (ushort)nLv;
                        boChgOK = true;
                        break;
                    case '+':
                        nLv = HUtil32._MAX(0, PlayObject.m_Abil.Level + nLevel);
                        nLv = HUtil32._MIN(M2Share.MAXLEVEL, nLv);
                        PlayObject.m_Abil.Level = (ushort)nLv;
                        PlayObject.HasLevelUp(1);
                        boChgOK = true;
                        break;
                }
                if (boChgOK)
                {
                    PlayObject.HasLevelUp(nOldLevel);// 等级调整记录日志 20080911
                    M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString()
                        + "\09" + PlayObject.m_sCharName + "\09" + (PlayObject.m_Abil.Level).ToString() + "\09" + "0" + "\09" + cMethod + "(" + (nLevel).ToString() + ")"
                        + "\09" + this.m_sCharName);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeLevel");
            }
        }

        /// <summary>
        /// 功能: 调整PK值
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangePkPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nPKPOINT;
            int nPoint;
            int nOldPKLevel;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nOldPKLevel = PlayObject.PKLevel();
                nPKPOINT = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nPKPOINT < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nPKPOINT)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEPKPOINT);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if ((nPKPOINT >= 0))
                        {
                            PlayObject.m_nPkPoint = nPKPOINT;
                        }
                        break;
                    case '-':
                        nPoint = HUtil32._MAX(0, PlayObject.m_nPkPoint - nPKPOINT);
                        PlayObject.m_nPkPoint = nPoint;
                        break;
                    case '+':
                        nPoint = HUtil32._MAX(0, PlayObject.m_nPkPoint + nPKPOINT);
                        PlayObject.m_nPkPoint = nPoint;
                        break;
                }
                if (nOldPKLevel != PlayObject.PKLevel())
                {
                    PlayObject.RefNameColor();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangePkPoint");
            }
        }

        /// <summary>
        /// 功能: 清除地图怪物
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfClearMapMon(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            List<TBaseObject> MonList;
            TBaseObject mon;
            int II;
            string sMap;
            try
            {
                // ----------------------------------------------------------------------------------------
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                // ======================================================================
                MonList = new List<TBaseObject>();
                try
                {
                    sMap = QuestActionInfo.sParam1;
                    if ((sMap != "") && (sMap[0] == '<') && (sMap[1] == '$'))
                    {
                        sMap = GetLineVariableText(PlayObject, QuestActionInfo.sParam1); // 增加支持<$Str()>
                    }
                    else
                    {
                        ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref sMap);
                    }
                    M2Share.UserEngine.GetMapMonster(M2Share.g_MapManager.FindMap(sMap), MonList);
                    if (MonList.Count > 0)
                    {
                        for (II = 0; II < MonList.Count; II++)
                        {
                            mon = MonList[II];
                            if ((mon.m_Master != null) && (mon.m_btRaceServer != 135)) //135的宝宝也要清除
                            {
                                continue;
                            }
                            if (M2Share.GetNoClearMonList(mon.m_sCharName))
                            {
                                continue;
                            }
                            mon.m_boNoItem = true;
                            mon.m_Abil.HP = 0;
                            mon.MakeGhost();
                        }
                    }
                }
                finally
                {

                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfClearMapMon");
            }
        }

        /// <summary>
        /// 功能: 清空文件内容(并带创建文件)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfClearNameList(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TStringList LoadList;
            string sListFileName;
            string s01;
            // ----------------------------------------------------------------------------------------
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            // ======================================================================
            s01 = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 路径支持变量
            if (s01[0] == '\\')
            {
                s01 = s01.Substring(2 - 1, s01.Length - 1);
            }
            if (s01[1] == '\\')
            {
                s01 = s01.Substring(3 - 1, s01.Length - 2);
            }
            if (s01[2] == '\\')
            {
                s01 = s01.Substring(4 - 1, s01.Length - 3);
            }
            sListFileName = M2Share.g_Config.sEnvirDir + s01;
            LoadList = new TStringList();
            try
            {
                LoadList.Clear();
                try
                {

                    LoadList.SaveToFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件保存失败 => " + sListFileName);
                }
            }
            finally
            {
            }
        }

        /// <summary>
        /// 功能：清除人物的所有技能。
        /// 格式：CLEARSKILL  (加参数HERO,即是删除英雄技能,空则是人物技能)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfClearSkill(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserMagic UserMagic;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CLEARSKILL);
                        return;
                    }
                    if (PlayObject.m_MyHero != null)
                    {
                        for (int i = PlayObject.m_MyHero.m_MagicList.Count - 1; i >= 0; i--)
                        {
                            if (PlayObject.m_MyHero.m_MagicList.Count <= 0)
                            {
                                break;
                            }
                            UserMagic = PlayObject.m_MyHero.m_MagicList[i];// 学过酒气护体,则把相关变量初始化
                            if ((UserMagic.MagicInfo.wMagicId == 68) && ((((THeroObject)(PlayObject.m_MyHero)).m_MaxExp68 != 0) || (((THeroObject)(PlayObject.m_MyHero)).m_Exp68 != 0)))
                            {
                                ((THeroObject)(PlayObject.m_MyHero)).m_MaxExp68 = 0;
                                ((THeroObject)(PlayObject.m_MyHero)).m_Exp68 = 0;
                            }
                            PlayObject.m_MyHero.m_MagicList.RemoveAt(i);
                            ((THeroObject)(PlayObject.m_MyHero)).SendDelMagic(UserMagic);
                            UserMagic = null;
                        }
                        ((THeroObject)(PlayObject.m_MyHero)).RecalcAbilitys();
                        PlayObject.m_MyHero.CompareSuitItem(false);//套装
                    }
                }
                else
                {
                    for (int i = PlayObject.m_MagicList.Count - 1; i >= 0; i--)
                    {
                        if (PlayObject.m_MagicList.Count <= 0)
                        {
                            break;
                        }
                        UserMagic = PlayObject.m_MagicList[i];
                        if ((UserMagic.MagicInfo.wMagicId == 68) && ((PlayObject.m_MaxExp68 != 0) || (PlayObject.m_Exp68 != 0))) // 是酒气护体
                        {
                            PlayObject.m_MaxExp68 = 0;
                            PlayObject.m_Exp68 = 0;
                        }
                        PlayObject.SendDelMagic(UserMagic);
                        UserMagic = null;
                        PlayObject.m_MagicList.RemoveAt(i);
                    }
                    PlayObject.RecalcAbilitys();
                    PlayObject.CompareSuitItem(false);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfClearSkill");
            }
        }

        /// <summary>
        /// 功能：清除人物非本职业的所有技能
        /// 格式：DELNOJOBSKILL    (加参数HERO,即是删除英雄技能,空则是人物技能)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfDelNoJobSkill(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserMagic UserMagic;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_DELNOJOBSKILL);
                        return;
                    }
                    if (PlayObject.m_MyHero != null)
                    {
                        for (int i = PlayObject.m_MyHero.m_MagicList.Count - 1; i >= 0; i--)
                        {
                            if (PlayObject.m_MyHero.m_MagicList.Count <= 0)
                            {
                                break;
                            }
                            UserMagic = PlayObject.m_MyHero.m_MagicList[i];
                            if (UserMagic.MagicInfo.btJob != PlayObject.m_MyHero.m_btJob) // 学过酒气护体,则把相关变量初始化
                            {
                                if ((UserMagic.MagicInfo.wMagicId == 68) && ((((THeroObject)(PlayObject.m_MyHero)).m_MaxExp68 != 0) || (((THeroObject)(PlayObject.m_MyHero)).m_Exp68 != 0)))
                                {
                                    ((THeroObject)(PlayObject.m_MyHero)).m_MaxExp68 = 0;
                                    ((THeroObject)(PlayObject.m_MyHero)).m_Exp68 = 0;
                                }
                                PlayObject.m_MyHero.m_MagicList.RemoveAt(i);
                                ((THeroObject)(PlayObject.m_MyHero)).SendDelMagic(UserMagic);
                                UserMagic = null;
                            }
                        }
                        ((THeroObject)(PlayObject.m_MyHero)).RecalcAbilitys();
                        PlayObject.m_MyHero.CompareSuitItem(false);// 套装
                    }
                }
                else
                {
                    for (int i = PlayObject.m_MagicList.Count - 1; i >= 0; i--)
                    {
                        if (PlayObject.m_MagicList.Count <= 0)
                        {
                            break;
                        }
                        UserMagic = PlayObject.m_MagicList[i];
                        if (UserMagic.MagicInfo.btJob != PlayObject.m_btJob)
                        {
                            if ((UserMagic.MagicInfo.wMagicId == 68) && ((PlayObject.m_MaxExp68 != 0) || (PlayObject.m_Exp68 != 0))) // 是酒气护体
                            {
                                PlayObject.m_MaxExp68 = 0;
                                PlayObject.m_Exp68 = 0;
                            }
                            PlayObject.SendDelMagic(UserMagic);
                            UserMagic = null;
                            PlayObject.m_MagicList.RemoveAt(i);
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfDelNoJobSkill");
            }
        }

        /// <summary>
        /// 功能：删除技能
        /// 格式：DELSKILL 技能名称 HERO  (加参数HERO,即是删除英雄技能)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfDelSkill(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {

            string sMagicName;
            TMagic Magic;
            TUserMagic UserMagic;
            try
            {
                // ----------------------------------------------------------------------------------------
                if (QuestActionInfo.sParam6 == "88")
                {
                    // 无忧加对非本人执行脚本
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                // ======================================================================
                sMagicName = QuestActionInfo.sParam1;
                if ((QuestActionInfo.sParam2).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_DELSKILL);
                        return;
                    }
                    Magic = M2Share.UserEngine.FindHeroMagic(sMagicName);
                    if (Magic == null)
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_DELSKILL);
                        return;
                    }
                    if (PlayObject.m_MyHero != null)
                    {
                        for (var i = PlayObject.m_MyHero.m_MagicList.Count - 1; i >= 0; i--)
                        {
                            if (PlayObject.m_MyHero.m_MagicList.Count <= 0)
                            {
                                break;
                            }
                            UserMagic = PlayObject.m_MyHero.m_MagicList[i];
                            if (UserMagic.MagicInfo == Magic)
                            {
                                PlayObject.m_MyHero.m_MagicList.RemoveAt(i);
                                ((THeroObject)(PlayObject.m_MyHero)).SendDelMagic(UserMagic);
                                UserMagic = null;
                                break;
                            }
                        }
                        ((THeroObject)(PlayObject.m_MyHero)).RecalcAbilitys();
                        PlayObject.m_MyHero.CompareSuitItem(false);// 套装
                    }
                }
                else
                {
                    Magic = M2Share.UserEngine.FindMagic(sMagicName);
                    if (Magic == null)
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_DELSKILL);
                        return;
                    }
                    for (var i = PlayObject.m_MagicList.Count - 1; i >= 0; i--)
                    {
                        if (PlayObject.m_MagicList.Count <= 0)
                        {
                            break;
                        }
                        UserMagic = PlayObject.m_MagicList[i];
                        if (UserMagic.MagicInfo == Magic)
                        {
                            PlayObject.m_MagicList.RemoveAt(i);
                            PlayObject.SendDelMagic(UserMagic);
                            UserMagic = null;
                            break;
                        }
                    }
                    PlayObject.RecalcAbilitys();
                    PlayObject.CompareSuitItem(false);//套装
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfDelSkill");
            }
        }

        /// <summary>
        /// 功能：调整游戏币(元宝)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGameGold(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGameGold;
            int nOldGameGold;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nOldGameGold = PlayObject.m_nGameGold;
                nGameGold = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nGameGold < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nGameGold)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GAMEGOLD);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if ((nGameGold >= 0))
                        {
                            PlayObject.m_nGameGold = nGameGold;
                        }
                        break;
                    case '-':
                        PlayObject.m_nGameGold = HUtil32._MAX(0, PlayObject.m_nGameGold - nGameGold);
                        break;
                    case '+':
                        PlayObject.m_nGameGold = HUtil32._MIN(Int32.MaxValue, PlayObject.m_nGameGold + nGameGold);
                        break;
                }
                if (M2Share.g_boGameLogGameGold)
                {
                    M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD, PlayObject.m_sMapName, PlayObject.m_nCurrX,
                        PlayObject.m_nCurrY, PlayObject.m_sCharName, M2Share.g_Config.sGameGoldName, PlayObject.m_nGameGold, cMethod + "(" + (nGameGold).ToString() + ")",
                        this.m_sCharName));
                }
                if (nOldGameGold != PlayObject.m_nGameGold)
                {
                    PlayObject.GameGoldChanged();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGameGold");
            }
        }

        /// <summary>
        /// 功能：调整金刚石动作
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGameDiaMond(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGameDiaMond;
            int nOldGameDiaMond;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nOldGameDiaMond = PlayObject.m_nGAMEDIAMOND;
                nGameDiaMond = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nGameDiaMond < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nGameDiaMond)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GAMEDIAMOND);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if ((nGameDiaMond >= 0))
                        {
                            PlayObject.m_nGAMEDIAMOND = nGameDiaMond;
                        }
                        break;
                    case '-':
                        PlayObject.m_nGAMEDIAMOND = HUtil32._MAX(0, PlayObject.m_nGAMEDIAMOND - nGameDiaMond);
                        break;
                    case '+':
                        PlayObject.m_nGAMEDIAMOND = HUtil32._MIN(Int32.MaxValue, PlayObject.m_nGAMEDIAMOND + nGameDiaMond);
                        break;
                }
                if (M2Share.g_boGameLogGameDiaMond)
                {
                    M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GameDiaMond, PlayObject.m_sMapName,
                        PlayObject.m_nCurrX, PlayObject.m_nCurrY, PlayObject.m_sCharName, M2Share.g_Config.sGameDiaMond, PlayObject.m_nGAMEDIAMOND,
                        cMethod + "(" + (nGameDiaMond).ToString() + ")", this.m_sCharName));
                }
                if (nOldGameDiaMond != PlayObject.m_nGAMEDIAMOND)
                {
                    PlayObject.GameGoldChanged();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGameDiaMond");
            }
        }

        /// <summary>
        /// 功能：调整灵符动作
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGameGird(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGameGird;
            int nOldGameGird;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nOldGameGird = PlayObject.m_nGAMEGIRD;
                nGameGird = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nGameGird < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nGameGird)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GAMEGIRD);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if ((nGameGird >= 0))
                        {
                            PlayObject.m_nGAMEGIRD = nGameGird;
                        }
                        break;
                    case '-':
                        PlayObject.m_nGAMEGIRD = HUtil32._MAX(0, PlayObject.m_nGAMEGIRD - nGameGird);
                        PlayObject.m_UseGameGird = nGameGird;// 灵符使用计数
                        if (M2Share.g_FunctionNPC != null)
                        {
                            M2Share.g_FunctionNPC.GotoLable(PlayObject, "@USEGAMEGIRD", false); // 灵符使用触发
                        }
                        break;
                    case '+':
                        PlayObject.m_nGAMEGIRD = HUtil32._MIN(Int32.MaxValue, PlayObject.m_nGAMEGIRD + nGameGird);
                        break;
                }
                if (M2Share.g_boGameLogGameGird)
                {
                    M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GameGird, PlayObject.m_sMapName,
                        PlayObject.m_nCurrX, PlayObject.m_nCurrY, PlayObject.m_sCharName, M2Share.g_Config.sGameGird, PlayObject.m_nGAMEGIRD, cMethod
                        + "(" + (nGameGird).ToString() + ")", this.m_sCharName));
                }
                if (nOldGameGird != PlayObject.m_nGAMEGIRD)
                {
                    PlayObject.GameGoldChanged();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGameGird");
            }
        }

        /// <summary>
        /// 功能：调整英雄技能升级点数 
        /// 格式: ChangeHeroTranPoint 技能名 操作符(+ - =) 数值
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfCHANGEHEROTRANPOINT(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nTranPoint;
            int nOldTranPoint;
            string sMagicName;
            string cMethod;
            TUserMagic UserMagic;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.m_MyHero == null)
                {
                    return;
                }
                sMagicName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                nTranPoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);
                if ((nTranPoint < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref nTranPoint)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROTRANPOINT);
                    return;
                }
                cMethod = QuestActionInfo.sParam2[0].ToString();
                if ((sMagicName == "") && (cMethod == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROTRANPOINT);
                    return;
                }
                UserMagic = ((TPlayObject)(PlayObject.m_MyHero)).GetMagicInfo(sMagicName);
                if (UserMagic != null)
                {
                    nOldTranPoint = UserMagic.nTranPoint;
                    switch (cMethod)
                    {
                        case "=":
                            if ((nTranPoint >= 0))
                            {
                                UserMagic.nTranPoint = nTranPoint;
                            }
                            break;
                        case "-":
                            nTranPoint = HUtil32._MAX(0, UserMagic.nTranPoint - nTranPoint);
                            if (nTranPoint < 0)
                            {
                                nTranPoint = 0;
                            }
                            UserMagic.nTranPoint = nTranPoint;
                            break;
                        case "+":
                            if ((UserMagic.btLevel < 3) && (UserMagic.MagicInfo.TrainLevel[UserMagic.btLevel] <= PlayObject.m_MyHero.m_Abil.Level))
                            {
                                nTranPoint = HUtil32._MAX(0, UserMagic.nTranPoint + nTranPoint);
                                UserMagic.nTranPoint = nTranPoint;
                            }
                            break;
                    }
                    if (nOldTranPoint != UserMagic.nTranPoint)
                    {
                        if (!((THeroObject)(PlayObject.m_MyHero)).CheckMagicLevelup(UserMagic))
                        {
                            ((THeroObject)(PlayObject.m_MyHero)).SendDelayMsg(PlayObject.m_MyHero, Grobal2.RM_HEROMAGIC_LVEXP, 0, UserMagic.MagicInfo.wMagicId, UserMagic.btLevel, UserMagic.nTranPoint, "", 500);
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCHANGEHEROTRANPOINT");
            }
        }

        /// <summary>
        /// 功能：寄放英雄 
        /// 英雄必须要在线,成功后,英雄退出,再召唤英雄,没有提示
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfSAVEHERO(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))//玩家没有英雄
                {
                    if (PlayObject.m_boPlayDrink)
                    {
                        GotoLable(PlayObject, "~PlayDrink_Already_NotHero", false);
                    }
                    else
                    {
                        return;
                    }
                }
                if (PlayObject.m_MyHero != null) // 英雄在线,才能进寄放
                {
                    if (((THeroObject)(PlayObject.m_MyHero)).m_btMentHero == 1)
                    {
                        GotoLable(PlayObject, "@NoSaveHero2", false);
                        return;
                    }
                    if (((THeroObject)(PlayObject.m_MyHero)).m_btMentHero == 2)
                    {
                        GotoLable(PlayObject, "@NoSaveHero3", false);
                        return;
                    }
                    PlayObject.m_sHeroCharName = "";// 将主人的英雄名清空,达到不能召唤英雄的目的
                    PlayObject.n_HeroSave = 1;// 寄放英雄标识
                    PlayObject.ClientHeroLogOut(1);// 英雄退出,没有提示
                    GotoLable(PlayObject, "~PlayDrink_HeroOk", false);
                }
                else
                {
                    if (PlayObject.m_boPlayDrink)  // 英雄不在线
                    {
                        GotoLable(PlayObject, "~PlayDrink_Already_HeroBegin", false);
                    }
                    else
                    {
                        GotoLable(PlayObject, "~PlayDrink_HeroBegin", false);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSAVEHERO");
            }
        }

        /// <summary>
        /// 功能：取回英雄
        /// 有两个英雄时,需全寄放后,才能取回一个英雄
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGETHERO(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((PlayObject.m_sHeroCharName == "") && (PlayObject.m_boHasHero || PlayObject.m_boHasHeroTwo))// 身上没有英雄才能取回
                {
                    // 发消息,显示取回英雄的窗口,选择后,改变主人变量,
                    M2Share.FrontEngine.AddToLoadHeroRcdList(PlayObject.m_sCharName, "", PlayObject, 3);
                }
                else
                {
                    if (M2Share.g_FunctionNPC != null)
                    {
                        M2Share.g_FunctionNPC.GotoLable(PlayObject, "@GetHeroBak", false);//没有存放英雄
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGETHERO");
            }
        }

        /// <summary>
        /// 功能：关闭斗酒,请酒窗口 
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCLOSEDRINK(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.SendMsg(this, Grobal2.RM_CLOSEDRINK, 0, 0, 0, 0, "");
                PlayObject.n_DrinkValue[0] = 0;// 喝酒的醉酒值 0-NPC 1-玩家
                PlayObject.n_DrinkValue[1] = 0;
                PlayObject.n_DrinkCount = 0;// 喝酒的次数(斗酒一次最高6次)
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCLOSEDRINK");
            }
        }

        /// <summary>
        /// 关闭斗酒窗口
        /// 斗酒窗口说话信息
        /// 格式:PLAYDRINKMSG 类型 说话信息
        /// (设置请酒显示内容) PLAYDRINKMSG 消息位置(1[上面],2[下面]) 消息内容(跟#say一样)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfPLAYDRINKMSG(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nDisplay;// 消息显示的位置
            string sMsg;// 消息内容
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nDisplay = (byte)HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                sMsg = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);
                if ((!new ArrayList(new int[] { 1, 2 }).Contains(nDisplay)) || (sMsg == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_PLAYDRINKMSG);
                    return;
                }
                PlayObject.SendMsg(this, Grobal2.RM_PLAYDRINKSAY, 0, 0, 0, nDisplay, sMsg);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfPLAYDRINKMSG");
            }
        }

        /// <summary>
        /// 打开酒界面 
        /// 格式:OPENPLAYDRINK 人物头像(0,1,2) 人物名字(0:翔天,1:辰星,2:影月)  DRINK----(打开斗酒界面)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfOPENPLAYDRINK(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nIcon;// 人物头像
            string sName = string.Empty;// 人物名称
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nIcon = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                sName = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);
                if (nIcon < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nIcon);
                }
                if ((nIcon < 0) || (nIcon > 3) || (sName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_OPENPLAYDRINK);
                    return;
                }
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("DRINK").ToLower()) == 0)
                {
                    PlayObject.SendMsg(this, Grobal2.RM_OPENPLAYDRINK, 0, 0, 1, nIcon, sName);// 打开斗酒界面
                    PlayObject.n_DrinkValue[0] = 0;// 喝酒的醉酒值 0-NPC 1-玩家
                    PlayObject.n_DrinkValue[1] = 0;
                    PlayObject.n_DrinkCount = 0;// 喝酒的次数(斗酒一次最高6次)
                }
                else
                {

                    if (PlayObject.m_boPlayDrink)// 打开请酒界面
                    {
                        // 已请过酒的直接操作
                        GotoLable(PlayObject, "@SaveHero", false);
                    }
                    else
                    {
                        // 没请过酒的,打开请酒界面
                        PlayObject.SendMsg(this, Grobal2.RM_OPENPLAYDRINK, 0, 0, 2, nIcon, sName);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfOPENPLAYDRINK");
            }
        }

        /// <summary>
        /// 功能：调整人物属性
        /// 格式：CHANGEHUMABILITY 属性(0-8) 操作符(=/-/+) 属性值(1-65535) 时间(秒)
        /// 注意:调整后的属性效果只在人物在线时有效
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCHANGEHUMABILITY(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nValue;
            char cMethod;
            int nTime;
            ushort nValeu1;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nValue = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), -1);
                nValeu1 = (ushort)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), 0);
                nTime = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam4), 0);
                if ((nValue > 9) || (nValue < 0) || (nValeu1 == 0) || (nTime == 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHUMABILITY);
                    return;
                }
                cMethod = QuestActionInfo.sParam2[1];
                switch (cMethod)
                {
                    case '=':
                        PlayObject.m_wStatusArrValue[nValue] = nValeu1;

                        PlayObject.m_dwStatusArrTimeOutTick[nValue] = Convert.ToByte(HUtil32.GetTickCount() + nTime * 1000);
                        break;
                    case '-':
                        PlayObject.m_wStatusArrValue[nValue] = Convert.ToByte(HUtil32._MAX(0, PlayObject.m_wStatusArrValue[nValue] - nValeu1));

                        PlayObject.m_dwStatusArrTimeOutTick[nValue] = Convert.ToByte(HUtil32.GetTickCount() + nTime * 1000);
                        break;
                    case '+':
                        PlayObject.m_wStatusArrValue[nValue] = Convert.ToByte(PlayObject.m_wStatusArrValue[nValue] + nValeu1);
                        PlayObject.m_dwStatusArrTimeOutTick[nValue] = Convert.ToByte(HUtil32.GetTickCount() + nTime * 1000);
                        break;
                }
                if (PlayObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                {
                    //((THeroObject)(PlayObject)).RecalcAbilitys();
                    PlayObject.CompareSuitItem(false);// 套装
                    //((THeroObject)(PlayObject)).SendMsg(PlayObject, Grobal2.RM_HEROABILITY, 0, 0, 0, 0, "");// 发送英雄属性 
                }
                else
                {
                    PlayObject.RecalcAbilitys();
                    PlayObject.CompareSuitItem(false);// 套装
                    PlayObject.SendMsg(PlayObject, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCHANGEHUMABILITY");
            }
        }

        /// <summary>
        /// 功能：调整英雄的忠诚度
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfHeroLoyal(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nLoyal;
            int nOldLoyal;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.m_MyHero == null)
                {
                    return;
                }
                nOldLoyal = ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal;
                nLoyal = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                if ((nLoyal < 0) && (nLoyal > 10000) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nLoyal)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROLOYAL);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if ((nLoyal >= 0))
                        {
                            ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal = nLoyal;
                        }
                        break;
                    case '-':
                        nLoyal = HUtil32._MAX(0, ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal - nLoyal);
                        if (nLoyal < 0)
                        {
                            nLoyal = 0;
                        }
                        ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal = nLoyal;
                        break;
                    case '+':
                        nLoyal = HUtil32._MAX(0, ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal + nLoyal);
                        if (nLoyal > 10000)
                        {
                            nLoyal = 10000; // 修正NPC加忠诚度超过最大值
                        }
                        ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal = nLoyal;
                        break;
                }
                if (nOldLoyal != ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal)
                {
                    PlayObject.GameGoldChanged();
                    //this.m_DefMsg = EDcode.Units.EDcode.MakeDefaultMsg(Grobal2.SM_HEROABILITY, ((THeroObject)(PlayObject.m_MyHero)).m_btGender, 0, ((THeroObject)(PlayObject.m_MyHero)).m_btJob, ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal, 0);
                    //((THeroObject)(PlayObject.m_MyHero)).SendSocket(this.m_DefMsg, EDcode.Units.EDcode.EncodeBuffer(((THeroObject)(PlayObject.m_MyHero)).m_WAbil, sizeof(TAbility)));
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfHeroLoyal");
            }
        }

        /// <summary>
        /// 功能:调整泡点
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGamePoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGamePoint;
            int nOldGamePoint;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nOldGamePoint = PlayObject.m_nGamePoint;
                nGamePoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if ((nGamePoint < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nGamePoint)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GAMEPOINT);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if ((nGamePoint >= 0))
                        {
                            PlayObject.m_nGamePoint = (UInt16)nGamePoint;
                        }
                        break;
                    case '-':
                        nGamePoint = HUtil32._MAX(0, PlayObject.m_nGamePoint - nGamePoint);
                        PlayObject.m_nGamePoint = (UInt16)nGamePoint;
                        break;
                    case '+':
                        nGamePoint = HUtil32._MAX(0, PlayObject.m_nGamePoint + nGamePoint);
                        PlayObject.m_nGamePoint = (UInt16)nGamePoint;
                        break;
                }
                if (M2Share.g_boGameLogGamePoint)
                {
                    M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEPOINT, PlayObject.m_sMapName, PlayObject.m_nCurrX,
                        PlayObject.m_nCurrY, PlayObject.m_sCharName, M2Share.g_Config.sGamePointName, PlayObject.m_nGamePoint, cMethod + "("
                        + (nGamePoint).ToString() + ")", this.m_sCharName));
                }
                if (nOldGamePoint != PlayObject.m_nGamePoint)
                {
                    PlayObject.GameGoldChanged();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGamePoint");
            }
        }

        private void ActionOfGetMarry(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TBaseObject PoseBaseObject;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PoseBaseObject = PlayObject.GetPoseCreate();
                if ((PoseBaseObject != null) && (PoseBaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT) && (PoseBaseObject.m_btGender != PlayObject.m_btGender))
                {
                    PlayObject.m_sDearName = PoseBaseObject.m_sCharName;
                    PlayObject.RefShowName();
                    PoseBaseObject.RefShowName();
                }
                else
                {
                    GotoLable(PlayObject, "@MarryError", false);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGetMarry");
            }
        }

        private void ActionOfGetMaster(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TBaseObject PoseBaseObject;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PoseBaseObject = PlayObject.GetPoseCreate();
                if ((PoseBaseObject != null) && (PoseBaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT) && (PoseBaseObject.m_btGender != PlayObject.m_btGender))
                {
                    PlayObject.m_sMasterName = PoseBaseObject.m_sCharName;
                    PlayObject.RefShowName();
                    PoseBaseObject.RefShowName();
                }
                else
                {
                    GotoLable(PlayObject, "@MasterError", false);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGetMaster");
            }
        }

        /// <summary>
        /// 功能：利用NPC发送信息 20081214 支持自定义颜色
        /// 格式: SENDMSG 信息类型代码 %s信息内容%d 字体颜色(0-255) 背景颜色(0-255)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfLineMsg(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sMsg;
            string sParam2 = string.Empty;
            byte FColor = 0;
            byte BColor = 0;
            bool boIsCustom;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                boIsCustom = false;
                sParam2 = QuestActionInfo.sParam2;
                if ((QuestActionInfo.sParam3 != "") && (QuestActionInfo.sParam4 != ""))  // 如设置了自定义颜色时
                {
                    FColor = (byte)HUtil32._MIN(255, HUtil32.Str_ToInt(QuestActionInfo.sParam3, 0));
                    BColor = (byte)HUtil32._MIN(255, HUtil32.Str_ToInt(QuestActionInfo.sParam4, 0));
                    boIsCustom = true;
                }
                ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref sParam2);
                sMsg = GetLineVariableText(PlayObject, sParam2);
                sMsg = sMsg.Replace("%s", PlayObject.m_sCharName);
                sMsg = sMsg.Replace("%x", (PlayObject.m_nCurrX).ToString());
                sMsg = sMsg.Replace("%y", (PlayObject.m_nCurrY).ToString());
                if (PlayObject.m_PEnvir != null)
                {
                    sMsg = sMsg.Replace("%m", PlayObject.m_PEnvir.sMapDesc);
                }
                else
                {
                    sMsg = sMsg.Replace("%m", "????");
                }
                sMsg = sMsg.Replace("%d", this.m_sCharName);
                switch (QuestActionInfo.nParam1)
                {
                    case 0:
                        if (!boIsCustom)
                        {
                            M2Share.UserEngine.SendBroadCastMsg(sMsg, TMsgType.t_System);
                        }
                        else
                        {
                            M2Share.UserEngine.SendBroadCastMsg1(sMsg, TMsgType.t_System, FColor, BColor);
                        }
                        break;
                    case 1:
                        // 0
                        if (!boIsCustom)
                        {
                            // 发送普通红色广播信息
                            M2Share.UserEngine.SendBroadCastMsg("(*) " + sMsg, TMsgType.t_System);
                        }
                        else
                        {
                            M2Share.UserEngine.SendBroadCastMsg1("(*) " + sMsg, TMsgType.t_System, FColor, BColor);
                        }
                        break;
                    case 2:
                        // 1
                        if (!boIsCustom)
                        {
                            // 发送普通红色广播信息，并显示NPC名称
                            M2Share.UserEngine.SendBroadCastMsg("[" + this.m_sCharName + "]" + sMsg, TMsgType.t_System);
                        }
                        else
                        {
                            M2Share.UserEngine.SendBroadCastMsg1("[" + this.m_sCharName + "]" + sMsg, TMsgType.t_System, FColor, BColor);
                        }
                        break;
                    case 3:
                        // 2
                        if (!boIsCustom)
                        {
                            // 发送普通红色广播信息，并人物NPC名称
                            M2Share.UserEngine.SendBroadCastMsg("[" + PlayObject.m_sCharName + "]" + sMsg, TMsgType.t_System);
                        }
                        else
                        {
                            M2Share.UserEngine.SendBroadCastMsg1("[" + PlayObject.m_sCharName + "]" + sMsg, TMsgType.t_System, FColor, BColor);
                        }
                        break;
                    case 4:
                        // 3
                        if (!boIsCustom)// 在NPC头顶，显示普通说话信息
                        {
                            this.ProcessSayMsg(sMsg);
                        }
                        else
                        {
                            this.ProcessExtendSayMsg(sMsg, FColor, BColor);
                        }
                        break;
                    case 5:
                        if (!boIsCustom)// 发送红色信息给人物
                        {
                            PlayObject.SysMsg(sMsg, TMsgColor.c_Red, TMsgType.t_Say);
                        }
                        else
                        {
                            PlayObject.SysMsg1(sMsg, TMsgColor.c_Red, TMsgType.t_Say, FColor, BColor);
                        }
                        break;
                    case 6:
                        if (!boIsCustom)// 发送绿色信息给人物
                        {
                            PlayObject.SysMsg(sMsg, TMsgColor.c_Green, TMsgType.t_Say);
                        }
                        else
                        {
                            PlayObject.SysMsg1(sMsg, TMsgColor.c_Green, TMsgType.t_Say, FColor, BColor);
                        }
                        break;
                    case 7:
                        if (!boIsCustom)// 发送蓝色信息给人物
                        {
                            PlayObject.SysMsg(sMsg, TMsgColor.c_Blue, TMsgType.t_Say);
                        }
                        else
                        {
                            PlayObject.SysMsg1(sMsg, TMsgColor.c_Blue, TMsgType.t_Say, FColor, BColor);
                        }
                        break;
                    case 8:
                        if (PlayObject.m_MyGuild != null)
                        {
                            if (!boIsCustom)  // 发送行会信息
                            {
                                PlayObject.m_MyGuild.SendGuildMsg(sMsg);
                            }
                            else
                            {
                                PlayObject.m_MyGuild.SendGuildMsg1(sMsg, FColor, BColor);
                            }
                        }
                        break;
                    default:
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSENDMSG);
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfLineMsg");
            }
        }

        /// <summary>
        /// 功能：创建文本文件
        /// 格式：CreateFile QuestDiary\NewFile.txt
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCreateFile(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sFileName;
            TStringList SaveList;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            sFileName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 文本路径
            if (sFileName[0] == '\\')
            {
                sFileName = sFileName.Substring(2 - 1, sFileName.Length - 1);
            }
            if (sFileName[1] == '\\')
            {
                sFileName = sFileName.Substring(3 - 1, sFileName.Length - 2);
            }
            if (sFileName[2] == '\\')
            {
                sFileName = sFileName.Substring(4 - 1, sFileName.Length - 3);
            }
            sFileName = M2Share.g_Config.sEnvirDir + sFileName;
            SaveList = new TStringList();
            try
            {
                if (!File.Exists(sFileName))
                {
                    try
                    {
                        SaveList.SaveToFile(sFileName);
                    }
                    catch
                    {
                        M2Share.MainOutMessage("文件保存失败 => " + sFileName);
                    }
                }
            }
            finally
            {
                Dispose(SaveList);
            }
        }

        /// <summary>
        /// 功能：顶端滚动公告
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfSendTopMsg(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sMsg;
            string sParam3 = string.Empty;
            int FColor;
            int BColor;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                FColor = QuestActionInfo.nParam1;
                BColor = QuestActionInfo.nParam2;
                sParam3 = QuestActionInfo.sParam3;
                // 消息文字
                ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref sParam3);
                sMsg = GetLineVariableText(PlayObject, sParam3);
                // 0为滚动
                PlayObject.SendRefMsg(Grobal2.RM_MOVEMESSAGE, 0, FColor, BColor, 0, sMsg);
                // 20080704 修改,使别人可以看到消息
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSendTopMsg");
            }
        }

        /// <summary>
        /// 顶端滚动公告
        /// 功能：屏幕居中显示公告 
        /// 格式：SendCenterMsg 前景色 背景色 消息文字 模式 显示时间(秒)
        /// 模式 0发给自己 1发送所有人 2发送行会 3发送当前地图
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfSendCenterMsg(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sMsg;
            string sParam3 = string.Empty;
            int FColor;
            int BColor;
            int nTime;
            int nMode;
            TPlayObject BaseObject;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nMode = -1;
                FColor = QuestActionInfo.nParam1;// 前景色
                BColor = QuestActionInfo.nParam2;// 背景色
                if (QuestActionInfo.sParam4 != "")
                {
                    nMode = HUtil32.Str_ToInt(QuestActionInfo.sParam4, -1); // 模式
                }
                nTime = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam5), 0);// 时间
                sParam3 = QuestActionInfo.sParam3;// 消息文字
                ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref sParam3);
                sMsg = GetLineVariableText(PlayObject, sParam3);
                switch (nMode)
                {
                    case 0:
                        PlayObject.SendMsg(PlayObject, Grobal2.RM_MOVEMESSAGE, 1, FColor, BColor, nTime, sMsg);
                        break;
                    case 1:// 发给自已
                        if (M2Share.UserEngine.m_PlayObjectList.Count > 0)
                        {
                            for (int i = 0; i < M2Share.UserEngine.m_PlayObjectList.Count; i++)
                            {
                                BaseObject = M2Share.UserEngine.m_PlayObjectList[i];
                                if (BaseObject != null)
                                {
                                    if (!BaseObject.m_boGhost)
                                    {
                                        BaseObject.SendMsg(PlayObject, Grobal2.RM_MOVEMESSAGE, 1, FColor, BColor, nTime, sMsg);
                                    }
                                }
                            }
                        }
                        break;
                    case 2:// 发送行会
                        if (PlayObject.m_MyGuild != null)
                        {
                            if (M2Share.UserEngine.m_PlayObjectList.Count > 0)
                            {
                                for (int i = 0; i < M2Share.UserEngine.m_PlayObjectList.Count; i++)
                                {
                                    BaseObject = M2Share.UserEngine.m_PlayObjectList[i];
                                    if (BaseObject != null)
                                    {
                                        if (!BaseObject.m_boDeath && !BaseObject.m_boGhost && PlayObject.m_MyGuild.IsMember(BaseObject.m_sCharName))
                                        {
                                            BaseObject.SendMsg(PlayObject, Grobal2.RM_MOVEMESSAGE, 1, FColor, BColor, nTime, sMsg);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    case 3:// 当前地图
                        if (M2Share.UserEngine.m_PlayObjectList.Count > 0)
                        {
                            for (int i = 0; i < M2Share.UserEngine.m_PlayObjectList.Count; i++)
                            {
                                BaseObject = M2Share.UserEngine.m_PlayObjectList[i];
                                if (BaseObject != null)
                                {
                                    if (!BaseObject.m_boDeath && !BaseObject.m_boGhost && (BaseObject.m_PEnvir == PlayObject.m_PEnvir))
                                    {
                                        BaseObject.SendMsg(PlayObject, Grobal2.RM_MOVEMESSAGE, 1, FColor, BColor, nTime, sMsg);
                                    }
                                }
                            }
                        }
                        break;
                    default:
                        PlayObject.SendRefMsg(Grobal2.RM_MOVEMESSAGE, 1, FColor, BColor, nTime, sMsg);
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSendCenterMsg");
            }
        }

        /// <summary>
        /// 聊天框顶端公告
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfSendEditTopMsg(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sMsg;
            string sParam3 = string.Empty;
            int FColor;
            int BColor;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                FColor = QuestActionInfo.nParam1;
                BColor = QuestActionInfo.nParam2;
                sParam3 = QuestActionInfo.sParam3;
                ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref sParam3);
                sMsg = GetLineVariableText(PlayObject, sParam3);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSendEditTopMsg");
            }
        }

        /// <summary>
        ///  功能:打开酿酒窗口 
        ///  格式:OPENMAKEWINE X(0,1) 0-酿造普通酒 1-酿造药酒
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfOPENMAKEWINE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nCode = 0;
            TUserItem UserItem;
            TStdItem StdItem;
            bool boIsCanOpenMakeWine;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (((this) as TMerchant).m_boPlayMakeWine)// 酿酒NPC标识
                {
                    nCode = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 2);// 打开窗口标识
                    if (!new ArrayList(new int[] { 0, 1 }).Contains(nCode))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sOPENMAKEWINE);
                        return;
                    }
                    boIsCanOpenMakeWine = false;// 是否可以酿酒
                    if (PlayObject.m_ItemList.Count > 0)
                    {
                        for (int i = 0; i < PlayObject.m_ItemList.Count; i++)
                        {
                            UserItem = (TUserItem)PlayObject.m_ItemList[i]; // 判断玩家包裹是否有酒器,有则可进行,没有则返回
                            StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                            if ((StdItem != null) && (StdItem.StdMode == 12)) // 有酒器
                            {
                                boIsCanOpenMakeWine = true;
                                break;
                            }
                        }
                    }
                    if (boIsCanOpenMakeWine)
                    {
                        PlayObject.SendMsg(this, Grobal2.RM_OPENMAKEWINE, 0, nCode, 0, 0, this.m_sCharName);
                    }
                    else
                    {
                        GotoLable(PlayObject, "@NoCanMakeWine", false);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfOPENMAKEWINE");
            }
        }

        /// <summary>
        /// 功能:取回酿好的酒
        /// 格式:GETGOODMAKEWINE
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfGETGOODMAKEWINE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserItem UserItem = null;
            TUserItem UserItem1 = null;
            TStdItem StdItem;
            TStdItem StdItem1;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            PlayObject.bo_NPCMove = false;// 是否点击,让NPC走动
            try
            {
                if (((this) as TMerchant).m_boPlayMakeWine) // 酿酒NPC标识
                {
                    if (PlayObject.m_boMakeWine)// 在NPC处正在酿酒
                    {
                        // 判断酿酒时间是否到,如果到时间则给玩家对应的酒,并且的种类为0时
                        if ((PlayObject.m_MakeWineTime == 0) && (PlayObject.n_MakeWineItmeType != 0))
                        {
                            StdItem = M2Share.UserEngine.GetMakeWineStdItem(PlayObject.n_MakeWineItmeType);
                            if ((StdItem != null) && (StdItem.AniCount == PlayObject.n_MakeWineType))
                            {
                                UserItem = new TUserItem();
                                if (M2Share.UserEngine.CopyToUserItemFromName(StdItem.Name, UserItem))
                                {
                                    PlayObject.m_boMakeWine = false;// 改变标识,不管包裹满否
                                    if (PlayObject.IsEnoughBag() && PlayObject.IsAddWeightAvailable(StdItem.Weight))
                                    {
                                        // 包裹有位置则放到包裹里,没有则扔出物品
                                        // 改变品质及酒精度
                                        UserItem.btValue[0] = (byte)PlayObject.n_MakeWineQuality;// 酒的品质
                                        UserItem.btValue[1] = (byte)PlayObject.n_MakeWineAlcohol;// 酒精度
                                        if (PlayObject.n_MakeWineType == 2) // 药酒,有药力值
                                        {
                                            UserItem.btValue[2] = (byte)HUtil32._MAX(1, PlayObject.n_MakeWineQuality - 5);// 药酒至少可以增加1点药力值 20081210
                                        }
                                        if (StdItem.NeedIdentify == 1)
                                        {
                                            M2Share.AddGameDataLog("38" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString()
                                                + "\09" + PlayObject.m_sCharName + "\09" + StdItem.Name + "\09" + (UserItem.MakeIndex).ToString() + "\09" + (UserItem.btValue[0]).ToString()
                                                + "/" + (UserItem.btValue[1]).ToString() + "\09" + this.m_sCharName);
                                        }
                                        PlayObject.m_ItemList.Add(UserItem);
                                        if (PlayObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                        {
                                            PlayObject.SendAddItem(UserItem);
                                            PlayObject.SendUpdateItem(UserItem);// 更新物品
                                        }
                                        if ((HUtil32.Random(M2Share.g_Config.nMakeWineRate) == 0) && (PlayObject.n_MakeWineType == 1))   // 一定机率获得酒曲
                                        {
                                            StdItem1 = M2Share.UserEngine.GetMakeWineStdItem1(StdItem.Shape);// 通过酒的Shape得到酒曲
                                            if (StdItem1 != null)
                                            {
                                                UserItem1 = new TUserItem();
                                                if (M2Share.UserEngine.CopyToUserItemFromName(StdItem1.Name, UserItem1))
                                                {
                                                    if (PlayObject.IsEnoughBag() && PlayObject.IsAddWeightAvailable(StdItem1.Weight))
                                                    {
                                                        if (StdItem1.NeedIdentify == 1)
                                                        {
                                                            M2Share.AddGameDataLog("38" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString()
                                                                + "\09" + PlayObject.m_sCharName + "\09" + StdItem1.Name + "\09" + (UserItem1.MakeIndex).ToString() + "\09" + "1" + "\09"
                                                                + this.m_sCharName);
                                                        }
                                                        PlayObject.m_ItemList.Add(UserItem1);
                                                        if (PlayObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                        {
                                                            PlayObject.SendAddItem(UserItem1);
                                                            PlayObject.SendUpdateItem(UserItem1);// 更新物品
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    //Marshal.FreeHGlobal(UserItem1);
                                                }
                                            }
                                        }
                                        PlayObject.m_MakeWineTime = 0;
                                        PlayObject.n_MakeWineItmeType = 0;
                                        PlayObject.n_MakeWineQuality = 0;// 酿酒后,应该可以得到酒的品质
                                        PlayObject.n_MakeWineAlcohol = 0;// 酿酒后,应该可以得到酒的酒精度
                                        if (PlayObject.m_PEnvir == this.m_PEnvir)
                                        {
                                            GotoLable(PlayObject, "@EndMakeWine", false); // 酿酒完毕
                                        }
                                    }
                                    else
                                    {
                                        PlayObject.DropItemDown(UserItem, 3, false, false, PlayObject, PlayObject); // 扔物品
                                    }
                                }
                                else
                                {
                                    UserItem = null;
                                }
                            }
                        }
                        if ((PlayObject.m_MakeWineTime > 0) && (PlayObject.m_PEnvir == this.m_PEnvir))
                        {
                            GotoLable(PlayObject, "@NoMakeWineTimeOver", false);  // 时间还没有到
                        }
                    }
                    else
                    {
                        if (PlayObject.m_PEnvir == this.m_PEnvir)
                        {
                            GotoLable(PlayObject, "@NoMakeWine", false); // 没有酿酒
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGETGOODMAKEWINE");
            }
        }

        /// <summary>
        /// 功能:减少酿酒的时间 
        /// 格式:DECMAKEWINETIME N(秒) D(1,2) X(0,1)
        /// 参数:D-1普通酒 2-药酒
        /// X-0按指定值减少,1-减少时间在1分钟内
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfDECMAKEWINETIME(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nMakeWineType;
            byte nCode;
            uint mMakeWineTime;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            mMakeWineTime = (uint)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);// 缩短时间
            nMakeWineType = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 0);// 酒类型
            nCode = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), 0);// 操作类型
            try
            {
                if (((this) as TMerchant).m_boPlayMakeWine) // 酿酒NPC标识
                {
                    if (PlayObject.m_boMakeWine) // 在NPC处正在酿酒
                    {
                        if (PlayObject.n_MakeWineType == nMakeWineType)
                        {
                            switch (nCode)// 酒的类型一致
                            {
                                case 0:// 按指定的值减少时间
                                    PlayObject.m_MakeWineTime = Convert.ToUInt16(HUtil32._MAX(0, Convert.ToInt32(PlayObject.m_MakeWineTime - mMakeWineTime)));
                                    GotoLable(PlayObject, "@DecMakeWineTimeOK", false);
                                    break;
                                case 1:// 时间缩短在一分钟内
                                    PlayObject.m_MakeWineTime = Convert.ToUInt16(60 - HUtil32.Random(10));
                                    GotoLable(PlayObject, "@DecMakeWineTimeOK", false);
                                    break;
                            }
                        }
                        else
                        {
                            GotoLable(PlayObject, "@NoIsInMakeWine", false);// 没有酿酒
                        }
                    }
                    else
                    {
                        GotoLable(PlayObject, "@NoIsInMakeWine", false);// 没有酿酒
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfDECMAKEWINETIME");
            }
        }

        /// <summary>
        /// 功能:酿酒NPC的走动
        /// 格式:MAKEWINENPCMOVE
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfMAKEWINENPCMOVE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (!PlayObject.bo_NPCMove) // 是否点击,让NPC走动(防止不停的点击)
                {
                    if (PlayObject.m_boMakeWine) // 在NPC处正在酿酒
                    {
                        PlayObject.bo_NPCMove = true;
                        this.SendRefMsg(Grobal2.RM_NPCWALK, this.m_btDirection, this.m_nCurrX, this.m_nCurrY, 0, "");
                    }
                    else
                    {
                        GotoLable(PlayObject, "@NoIsInMakeWine", false);// 没有酿酒
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMAKEWINENPCMOVE");
            }
        }

        /// <summary>
        /// 功能:设置泉水喷发
        /// 格式:FOUNTAIN 地图 X Y 时间(秒)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfFOUNTAIN(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nX;
            int nY;
            int nTime;
            Envirnoment Envir;
            string sMap;
            TFlowerEvent FlowerEvent;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sMap = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 地图ID 支持变量
                nX = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 0);// X
                nY = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), 0);// Y
                nTime = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam4), 0);// Time
                if (sMap == "")
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sFOUNTAIN);
                    return;
                }
                Envir = M2Share.g_MapManager.FindMap(sMap);// 查找地图场景
                if (Envir != null)
                {
                    if (M2Share.g_EventManager.GetEvent(Envir, nX, nY, Grobal2.ET_FOUNTAIN) != null)
                    {
                        return;  // 如果有场景了,就直接退出
                    }
                    FlowerEvent = new TFlowerEvent(Envir, nX, nY, Grobal2.ET_FOUNTAIN, Convert.ToUInt32(nTime * 1000));
                    M2Share.g_EventManager.AddEvent(FlowerEvent);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfFOUNTAIN");
            }
        }

        /// <summary>
        /// 功能:开启/关闭行会泉水仓库 
        /// 格式:SETGUILDFOUNTAIN 0/1 (0-开,1-关)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfSETGUILDFOUNTAIN(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nCode;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nCode = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), -1);
                if ((nCode < 0) && (!new ArrayList(new int[] { 0, 1 }).Contains(nCode)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSETGUILDFOUNTAIN);
                    return;
                }
                if ((PlayObject.m_MyGuild != null) && (PlayObject.m_nGuildRankNo == 1))
                {
                    switch (nCode)
                    {
                        case 0:
                            PlayObject.m_MyGuild.boChanged = true;
                            PlayObject.m_MyGuild.boGuildFountainOpen = true;
                            GotoLable(PlayObject, "@OpenGuildFountain", false);
                            break;
                        case 1:
                            PlayObject.m_MyGuild.boChanged = true;
                            PlayObject.m_MyGuild.boGuildFountainOpen = false;
                            GotoLable(PlayObject, "@CloseGuildFountain", false);
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSETGUILDFOUNTAIN");
            }
        }

        /// <summary>
        /// 功能:领取行会泉水
        /// 格式:GIVEGUILDFOUNTAIN 物品名 数量
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfGIVEGUILDFOUNTAIN(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserItem UserItem = null;
            TStdItem StdItem;
            string sItemName;
            int nItemCount;
            int nDate = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sItemName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 增加变量支持
                nItemCount = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);// 属性 支持变量
                if (nItemCount < 0)
                {
                    nItemCount = QuestActionInfo.nParam2;
                }
                //nDate = Convert.ToInt32(FormatDatetime("YYYYMMDD", DateTime.Today));// 当前的日期
                if (PlayObject.m_MyGuild != null)
                {
                    if (PlayObject.m_MyGuild.boGuildFountainOpen) // 行会泉水仓库开启
                    {
                        if (PlayObject.m_GiveGuildFountationDate != nDate)
                        {
                            if (PlayObject.m_MyGuild.m_nGuildFountain >= M2Share.g_Config.nMinGuildFountain) // 行会蓄量不能少于指定值
                            {
                                PlayObject.m_MyGuild.boChanged = true;
                                PlayObject.m_MyGuild.m_nGuildFountain = HUtil32._MAX(0, PlayObject.m_MyGuild.m_nGuildFountain - M2Share.g_Config.nDecGuildFountain);
                                PlayObject.m_GiveGuildFountationDate = nDate;// 领取泉水的日期
                                if (M2Share.UserEngine.GetStdItemIdx(sItemName) > 0)
                                {
                                    if (!(nItemCount >= 1 && nItemCount <= 50))
                                    {
                                        nItemCount = 1;
                                    }
                                    for (int i = 0; i < nItemCount; i++)
                                    {
                                        if (PlayObject.IsEnoughBag())
                                        {
                                            UserItem = new TUserItem();
                                            if (M2Share.UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                                            {
                                                PlayObject.m_ItemList.Add(UserItem);
                                                PlayObject.SendAddItem(UserItem);
                                                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                                if (StdItem.NeedIdentify == 1)
                                                {
                                                    M2Share.AddGameDataLog("35" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09"
                                                        + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + sItemName + "\09" + (UserItem.MakeIndex).ToString()
                                                        + "\09" + "1" + "\09" + this.m_sCharName);
                                                }
                                            }
                                            else
                                            {
                                                UserItem = null;
                                            }
                                        }
                                        else
                                        {
                                            UserItem = new TUserItem();
                                            if (M2Share.UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                                            {
                                                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                                if (StdItem.NeedIdentify == 1)
                                                {
                                                    M2Share.AddGameDataLog("35" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + sItemName + "\09" + (UserItem.MakeIndex).ToString() + "\09" + "1" + "\09" + this.m_sCharName);
                                                }
                                                PlayObject.DropItemDown(UserItem, 3, false, false, PlayObject, PlayObject);
                                            }
                                            UserItem = null;
                                        }
                                    }
                                }
                                GotoLable(PlayObject, "@GIVEFOUNTAIN_OK", false);// 领取成功
                            }
                            else
                            {
                                GotoLable(PlayObject, "@NOGIVEFOUNTAIN", false); // 行会泉水量不足
                            }
                        }
                        else
                        {
                            GotoLable(PlayObject, "@NOGIVEFOUNTAIN1", false);// 已领取过泉水
                        }
                    }
                    else
                    {
                        GotoLable(PlayObject, "@GIVEFOUNTAINColse", false);// 行会酒泉关闭
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGIVEGUILDFOUNTAIN");
            }
        }

        /// <summary>
        /// 功能:NPC学习内功 
        /// 格式:READSKILLNG Hero
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfREADSKILLNG(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("HERO").ToLower()) == 0)// 英雄学习
                {
                    if ((PlayObject.m_MyHero != null) && (PlayObject.m_boTrainingNG))// 主号学过,英雄才能学习
                    {
                        if (!((THeroObject)(PlayObject.m_MyHero)).m_boTrainingNG) // 没学过内功
                        {
                            ((THeroObject)(PlayObject.m_MyHero)).m_boTrainingNG = true;
                            ((THeroObject)(PlayObject.m_MyHero)).m_NGLevel = 1;
                            ((THeroObject)(PlayObject.m_MyHero)).m_ExpSkill69 = 0;// 内功当前经验
                            PlayObject.m_MyHero.SendNGData();// 发送内功数据
                            PlayObject.m_MyHero.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTLEVELUP, 0, 0, 0, "");// 人物升级动画 
                            GotoLable(PlayObject, "@ReadNGHeroOK", false);
                        }
                        else
                        {
                            GotoLable(PlayObject, "@ReadNGHeroFail", false);
                        }
                    }
                    else
                    {
                        GotoLable(PlayObject, "@ReadNGHeroFail", false);
                    }
                }
                else
                {
                    if (!PlayObject.m_boTrainingNG)// 没学过内功
                    {
                        PlayObject.m_boTrainingNG = true;
                        PlayObject.m_NGLevel = 1;
                        PlayObject.m_ExpSkill69 = 0;// 内功当前经验
                        PlayObject.SendNGData();// 发送内功数据
                        PlayObject.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTLEVELUP, 0, 0, 0, "");// 人物升级动画 
                        GotoLable(PlayObject, "@ReadNGOK", false);
                    }
                    else
                    {
                        GotoLable(PlayObject, "@ReadNGFail", false);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfREADSKILLNG");
            }
        }

        /// <summary>
        /// 功能:挑战地图移动
        /// 格式:CHALLENGMAPMOVE 地图名 X Y
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCHALLENGMAPMOVE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nX;
            int nY;
            Envirnoment Envir;
            string sMap;
            bool m_boMoveOK;
            try
            {
                if ((PlayObject.m_ChallengeCreat == null) || (!PlayObject.m_boChallengeing))
                {
                    return;
                }
                m_boMoveOK = false;
                sMap = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 地图ID 支持变量
                nX = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 0);// X
                nY = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), 0);// Y
                if (sMap == "")
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sCHALLENGMAPMOVE);
                    return;
                }
                Envir = M2Share.g_MapManager.FindMap(sMap);// 查找地图场景
                if (Envir != null)  // 判断地图是否存在
                {
                    m_boMoveOK = true;
                    if (Envir.m_boFight4Zone)  // 并且是挑战地图
                    {
                        if (PlayObject.m_ChallengeCreat.m_MyHero != null)
                        {
                            PlayObject.m_ChallengeCreat.ClientHeroLogOut(1);  // 英雄退出,没有提示
                        }
                        if (PlayObject.m_MyHero != null)
                        {
                            PlayObject.ClientHeroLogOut(1); // 英雄退出,没有提示
                        }
                        PlayObject.m_sLastMapName = PlayObject.m_sMapName;
                        PlayObject.m_ChallengeCreat.m_sLastMapName = PlayObject.m_ChallengeCreat.m_sMapName;
                        PlayObject.m_ChallengeCreat.MapRandomMove(sMap, 0);
                        PlayObject.MapRandomMove(sMap, 0);
                        PlayObject.m_ChallengeTime = M2Share.g_Config.nChallengeTime;// 挑战计时
                        PlayObject.m_ChallengeCreat.m_ChallengeTime = M2Share.g_Config.nChallengeTime;// 挑战计时
                    }
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sCHALLENGMAPMOVE);
                    return;
                }
                if (!m_boMoveOK)
                {
                    if (M2Share.g_FunctionNPC != null)
                    {
                        M2Share.g_FunctionNPC.GotoLable(PlayObject, "@Challenge_Fail", false);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCHALLENGMAPMOVE");
            }
        }

        /// <summary>
        /// 功能:没有挑战地图可移动,则退回抵押的物品
        /// 格式:GETCHALLENGEBAKITEM
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGETCHALLENGEBAKITEM(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((PlayObject.m_ChallengeCreat == null) || (!PlayObject.m_boChallengeing))
                {
                    return;
                }
                PlayObject.m_boChallengeing = false;
                if (PlayObject.m_ChallengeCreat != null)
                {
                    PlayObject.m_ChallengeCreat.m_boChallengeing = false;
                    PlayObject.m_ChallengeCreat.GetBackChallengeItems();
                    PlayObject.m_ChallengeCreat.m_ChallengeCreat = null;
                    PlayObject.m_ChallengeCreat.m_ChallengeLastTick = HUtil32.GetTickCount();
                }
                PlayObject.m_ChallengeCreat = null;
                PlayObject.GetBackChallengeItems();

                PlayObject.m_ChallengeLastTick = HUtil32.GetTickCount();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGETCHALLENGEBAKITEM");
            }
        }

        /// <summary>
        /// 功能:人物在线英雄下线
        /// 格式:HEROLOGOUT
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfHEROLOGOUT(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            PlayObject.ClientHeroLogOut(0);// 英雄退出
        }

        /// <summary>
        /// 功能:修改魔法ID,并且等级为4
        /// 格式:CHANGESKILL 原魔法ID 新魔法ID Hero
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfCHANGESKILL(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TMagic Magic;
            TUserMagic UserMagic = null;
            TUserMagic UserMagic1 = null;
            ushort oldMagic = 0;
            ushort NewMagic = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                oldMagic = (ushort)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);
                NewMagic = (ushort)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 0);
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                    {
                        return;
                    }
                    Magic = M2Share.UserEngine.FindHeroMagic(NewMagic);
                    if (Magic != null)
                    {
                        if (PlayObject.m_MyHero != null)
                        {
                            if (!PlayObject.m_MyHero.IsTrainingSkill(Magic.wMagicId))
                            {
                                for (int i = PlayObject.m_MyHero.m_MagicList.Count - 1; i >= 0; i--)
                                {
                                    if (PlayObject.m_MyHero.m_MagicList.Count <= 0)
                                    {
                                        break;
                                    }
                                    UserMagic = PlayObject.m_MyHero.m_MagicList[i];
                                    if (UserMagic != null)
                                    {
                                        if (UserMagic.MagicInfo.wMagicId == oldMagic)
                                        {
                                            UserMagic1.MagicInfo = Magic;
                                            UserMagic1.wMagIdx = Magic.wMagicId;
                                            UserMagic1.btKey = UserMagic.btKey;
                                            UserMagic1.btLevel = 4;
                                            UserMagic1.MagicInfo.btTrainLv = 3;
                                            UserMagic1.nTranPoint = UserMagic1.MagicInfo.MaxTrain[3];
                                            PlayObject.m_MyHero.m_MagicList.RemoveAt(i);
                                            ((THeroObject)(PlayObject.m_MyHero)).SendDelMagic(UserMagic);
                                            PlayObject.m_MyHero.m_MagicList.Add(UserMagic1);
                                            ((THeroObject)(PlayObject.m_MyHero)).SendAddMagic(UserMagic1);
                                            ((THeroObject)(PlayObject.m_MyHero)).RecalcAbilitys();
                                            PlayObject.m_MyHero.CompareSuitItem(false);// 套装
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    Magic = M2Share.UserEngine.FindMagic(NewMagic);
                    if (Magic != null)
                    {
                        if (!PlayObject.IsTrainingSkill(Magic.wMagicId))
                        {
                            for (int i = PlayObject.m_MagicList.Count - 1; i >= 0; i--)
                            {
                                if (PlayObject.m_MagicList.Count <= 0)
                                {
                                    break;
                                }
                                UserMagic = PlayObject.m_MagicList[i];
                                if (UserMagic != null)
                                {
                                    if (UserMagic.MagicInfo.wMagicId == oldMagic)
                                    {
                                        UserMagic1.MagicInfo = Magic;
                                        UserMagic1.wMagIdx = Magic.wMagicId;
                                        UserMagic1.btKey = UserMagic.btKey;
                                        UserMagic1.btLevel = 4;
                                        UserMagic1.MagicInfo.btTrainLv = 3;
                                        UserMagic1.nTranPoint = UserMagic1.MagicInfo.MaxTrain[3];
                                        PlayObject.m_MagicList.RemoveAt(i);
                                        PlayObject.SendDelMagic(UserMagic);
                                        PlayObject.m_MagicList.Add(UserMagic1);
                                        PlayObject.SendAddMagic(UserMagic1);
                                        PlayObject.RecalcAbilitys();
                                        PlayObject.CompareSuitItem(false);// 套装
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCHANGESKILL");
            }
        }

        /// <summary>
        /// 功能:自动寻路
        /// 格式:AUTOGOTOXY X Y
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfAUTOGOTOXY(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nX;
            int nY;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nX = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);// X
                nY = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), 0);// Y
                PlayObject.SendMsg(this, Grobal2.RM_AUTOGOTOXY, 0, nX, nY, 0, "");
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfAUTOGOTOXY");
            }
        }

        /// <summary>
        /// 修理全身装备
        /// 格式：RepairAll (HERO)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfRepairAll(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nWhere;
            TStdItem StdItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        for (nWhere = m_UseItems.GetLowerBound(0); nWhere <= m_UseItems.GetUpperBound(0); nWhere++)
                        {
                            if (PlayObject.m_MyHero.m_UseItems[nWhere].wIndex > 0)
                            {
                                StdItem = M2Share.UserEngine.GetStdItem(PlayObject.m_MyHero.m_UseItems[nWhere].wIndex);
                                if (StdItem != null)
                                {
                                    if (((PlayObject.m_MyHero.m_UseItems[nWhere].DuraMax / 1000) > (PlayObject.m_MyHero.m_UseItems[nWhere].Dura / 1000)) && (StdItem.StdMode != 7)
                                        && (StdItem.StdMode != 25) && (StdItem.StdMode != 43) && (StdItem.AniCount != 21))
                                    {
                                        if (this.CheckItemValue(PlayObject.m_MyHero.m_UseItems[nWhere], 3))  //禁止修
                                        {
                                            continue;
                                        }
                                        else if (PlayObject.m_MyHero.PlugOfCheckCanItem(3, StdItem.Name, false, 0, 0)) // 禁止物品规则(管理插件功能)
                                        {
                                            continue;
                                        }
                                        PlayObject.m_MyHero.m_UseItems[nWhere].Dura = PlayObject.m_MyHero.m_UseItems[nWhere].DuraMax;
                                        PlayObject.SendMsg(PlayObject.m_MyHero, Grobal2.RM_HERODURACHANGE, nWhere, PlayObject.m_MyHero.m_UseItems[nWhere].Dura, PlayObject.m_MyHero.m_UseItems[nWhere].DuraMax, 0, "");
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    for (nWhere = m_UseItems.GetLowerBound(0); nWhere <= m_UseItems.GetUpperBound(0); nWhere++)
                    {
                        if (PlayObject.m_UseItems[nWhere].wIndex > 0)
                        {
                            StdItem = M2Share.UserEngine.GetStdItem(PlayObject.m_UseItems[nWhere].wIndex);
                            if (StdItem != null)
                            {
                                if (((PlayObject.m_UseItems[nWhere].DuraMax / 1000) > (PlayObject.m_UseItems[nWhere].Dura / 1000)) && (StdItem.StdMode != 7) && (StdItem.StdMode != 25)
                                    && (StdItem.StdMode != 43) && (StdItem.AniCount != 21))
                                {
                                    if (this.CheckItemValue(PlayObject.m_UseItems[nWhere], 3))//禁止修
                                    {
                                        continue;
                                    }
                                    else if (PlayObject.PlugOfCheckCanItem(3, StdItem.Name, false, 0, 0))  // 禁止物品规则(管理插件功能)
                                    {
                                        continue;
                                    }
                                    PlayObject.m_UseItems[nWhere].Dura = PlayObject.m_UseItems[nWhere].DuraMax;
                                    PlayObject.SendMsg(PlayObject, Grobal2.RM_DURACHANGE, nWhere, PlayObject.m_UseItems[nWhere].Dura, PlayObject.m_UseItems[nWhere].DuraMax, 0, "");
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfRepairAll");
            }
        }

        /// <summary>
        /// 踢除服务器所有人物
        /// 格式:KICKALLPLAY
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfKICKALLPLAY(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (M2Share.UserEngine.m_PlayObjectList.Count > 0)
                {
                    for (int i = 0; i < M2Share.UserEngine.m_PlayObjectList.Count; i++)
                    {
                        M2Share.UserEngine.m_PlayObjectList[i].m_boKickFlag = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfKICKALLPLAY");
            }
        }

        /// <summary>
        /// 功能：设置所有行会攻城
        /// 格式：ADDATTACKSABUKALL 城堡号
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfADDATTACKSABUKALL(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserCastle Castle;
            int nIndex;
            TGUild Guild;
            try
            {
                nIndex = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);// 城堡ID
                Castle = M2Share.g_CastleManager.GetCastle(nIndex);
                if (M2Share.g_GuildManager.GuildList.Count > 0)
                {
                    for (int i = 0; i < M2Share.g_GuildManager.GuildList.Count; i++)
                    {
                        Guild = M2Share.g_GuildManager.GuildList[i];
                        Castle.AddAttackerInfo(Guild, 1);
                        Castle.m_AttackGuildList.Add(Guild);//加入当前攻城列表
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfADDATTACKSABUKALL");
            }
        }

        /// <summary>
        /// 功能:连接指定网站网址
        /// 格式:WebBrowser http://www.eoehub.com
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfWEBBROWSER(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string Url;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Url = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                if (Url == "")
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sWEBBROWSER);
                    return;
                }
                if (Url.IndexOf("http://") == 0)
                {
                    Url = "http://" + Url;
                }
                PlayObject.SendMsg(this, Grobal2.RM_Browser, 0, 0, 0, 0, Url);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfWEBBROWSER");
            }
        }

        /// <summary>
        /// 取指定排行榜指定排名的玩家名字 
        /// 格式:GETSORTNAME 变量 Type(排行榜) 名次
        /// nType 1-等级榜 2-战士榜 3-法师榜 4-道士榜
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGETSORTNAME(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte nType;
            int nIndex;
            int n14;
            TStringList StringList = null;
            string CharName = string.Empty;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                n14 = M2Share.GetValNameNo(QuestActionInfo.sParam1);// 变量
                nType = (byte)QuestActionInfo.nParam2;// 排行榜类型
                nIndex = QuestActionInfo.nParam3;// 名次
                //if ((n14 < 600) || (!(int)nType >= 1 && !(int)nType<= 4) || (nIndex <= 0))
                //{
                //    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sGETSORTNAME);
                //    return;
                //}
                //EnterCriticalSection(M2Share.HumanSortCriticalSection);
                try
                {
                    switch (nType)
                    {
                        case 1:
                            StringList = M2Share.UserEngine.m_PlayObjectLevelList;
                            break;
                        case 2:
                            StringList = M2Share.UserEngine.m_WarrorObjectLevelList;
                            break;
                        case 3:
                            StringList = M2Share.UserEngine.m_WizardObjectLevelList;
                            break;
                        case 4:
                            StringList = M2Share.UserEngine.m_TaoistObjectLevelList;
                            break;
                    }
                    if (StringList != null)
                    {
                        if ((nIndex - 1) <= StringList.Count)
                        {
                            //CharName = ((string)(StringList[nIndex - 1]));
                            if (n14 >= 600)
                            {
                                switch (n14)
                                {
                                    // Modify the A .. B: 600 .. 699
                                    case 600:
                                        PlayObject.m_sString[n14 - 600] = CharName;
                                        break;
                                    // Modify the A .. B: 700 .. 799
                                    case 700:
                                        M2Share.g_Config.GlobalAVal[n14 - 700] = CharName;
                                        break;
                                    // Modify the A .. B: 1200 .. 1599
                                    case 1200:
                                        M2Share.g_Config.GlobalAVal[n14 - 1100] = CharName;
                                        break;
                                }
                            }
                        }
                    }
                }
                finally
                {

                    //  LeaveCriticalSection(M2Share.HumanSortCriticalSection);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGETSORTNAME");
            }
        }

        /// <summary>
        /// 功能：打开卧龙笔记
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfOPENBOOKS(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (QuestActionInfo.nParam1 >= 0 && QuestActionInfo.nParam1 <= 5)
                {
                    PlayObject.SendMsg(this, Grobal2.RM_OPENBOOKS, 0, QuestActionInfo.nParam1, 0, 0, "");
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfOPENBOOKS");
            }
        }

        /// <summary>
        /// 功能：开通元宝交易
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfOPENYBDEAL(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGameGold;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.bo_YBDEAL)// 如已开通元宝服务则退出
                {
                    PlayObject.SendMsg(this, Grobal2.RM_MERCHANTSAY, 0, 0, 0, 0, this.m_sCharName + "/您已开通寄售服务,不需要再开通！！！\\ \\<返回/@main>");
                    return;
                }
                nGameGold = HUtil32.Str_ToInt(QuestActionInfo.sParam1, 0);
                if (!(nGameGold > 0))
                {
                    nGameGold = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), 0);
                }
                if (PlayObject.m_nGameGold >= nGameGold) // 玩家的元宝数大于或等于开通所需的元宝数
                {
                    PlayObject.m_nGameGold -= nGameGold;
                    PlayObject.bo_YBDEAL = true;
                    PlayObject.SendMsg(this, Grobal2.RM_MERCHANTSAY, 0, 0, 0, 0, this.m_sCharName + "/开通寄售服务成功！！！\\ \\<返回/@main>");
                }
                else
                {
                    PlayObject.SendMsg(this, Grobal2.RM_MERCHANTSAY, 0, 0, 0, 0, this.m_sCharName + "/您身上没有" + M2Share.g_Config.sGameGoldName + ",或" + M2Share.g_Config.sGameGoldName + "数不够！！！\\ \\<返回/@main>");
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfOPENYBDEAL");
            }
        }

        /// <summary>
        /// 功能：(元宝)查询正在出售的物品 
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfQUERYYBSELL(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            //TDealOffInfo DealOffInfo;
            //string sSendStr = string.Empty;
            //string sUserItemName = string.Empty;
            //TClientDealOffInfo* sClientDealOffInfo = null;
            //TStdItem StdItem = null;
            //TStdItem StdItem80 = null;
            //TClientItem ClientDealUserItem;
            //TUserItem items = null;
            //bool bo12;
            //try
            //{
            //    if (QuestActionInfo.sParam6 == "88")
            //    {
            //        PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
            //        if (PlayObject == null)
            //        {
            //            return;
            //        }
            //    }
            //    bo12 = false;
            //    if (PlayObject.bo_YBDEAL)// 已开通元宝服务
            //    {
            //        if (PlayObject.SellOffInTime(0))
            //        {
            //            if (M2Share.sSellOffItemList.Count > 0)
            //            {
            //                for (int i = 0; i < M2Share.sSellOffItemList.Count; i++)
            //                {
            //                    DealOffInfo = M2Share.sSellOffItemList[i];
            //                    if (((DealOffInfo.sDealCharName).ToLower().CompareTo((PlayObject.m_sCharName).ToLower()) == 0)
            //                        && (new ArrayList(new int[] { 0, 3 }).Contains(DealOffInfo.N)))
            //                    {
            //                        for (int K = 0; K <= 9; K++)
            //                        {
            //                            StdItem = M2Share.UserEngine.GetStdItem(DealOffInfo.UseItems[K].wIndex);
            //                            if ((StdItem == null))// 是金刚石
            //                            {
            //                                if (!bo12 && (DealOffInfo.UseItems[K].MakeIndex > 0) && (DealOffInfo.UseItems[K].wIndex == ushort.MaxValue) && (DealOffInfo.UseItems[K].Dura == ushort.MaxValue)
            //                                    && (DealOffInfo.UseItems[K].DuraMax == ushort.MaxValue))
            //                                {
            //                                    TClientItem* Item = (TClientItem*)sClientDealOffInfo->UseItemsBuff[K];// '金刚石'
            //                                    HUtil32.StrToSByteArry(M2Share.g_Config.sGameDiaMond + "(" + (DealOffInfo.UseItems[K].MakeIndex).ToString() + ")", Item->s.Name, 14, ref Item->s.NameLen);
            //                                    Item->s.Price = DealOffInfo.UseItems[K].MakeIndex;// 金刚石数量
            //                                    Item->Dura = ushort.MaxValue;// 客户端金刚石特征 
            //                                    Item->s.DuraMax = ushort.MaxValue;// 客户端金刚石特征 
            //                                    Item->s.Looks = ushort.MaxValue;// 不显示图片
            //                                    bo12 = true;
            //                                }
            //                                else
            //                                {
            //                                    ClientDealUserItem = (TClientItem*)sClientDealOffInfo->UseItemsBuff;
            //                                    HUtil32.StrToSByteArry("", ClientDealUserItem.s.Name, 14, ref ClientDealUserItem.s.NameLen);
            //                                }
            //                                continue;
            //                            }
            //                            StdItem80 = StdItem;
            //                            *items = DealOffInfo.UseItems[K];
            //                            M2Share.ItemUnit.GetItemAddValue(items, StdItem80);
            //                            ClientDealUserItem = (TClientItem*)sClientDealOffInfo->UseItemsBuff;
            //                            ClientDealUserItem[K].s = StdItem80;
            //                            //Move(StdItem80, sClientDealOffInfo.UseItems[K].s, sizeof(TStdItem));
            //                            sUserItemName = "";// 取自定义物品名称
            //                            if (items->btValue[13] == 1)
            //                            {
            //                                sUserItemName = M2Share.ItemUnit.GetCustomItemName(DealOffInfo.UseItems[K].MakeIndex, DealOffInfo.UseItems[K].wIndex);
            //                            }
            //                            if (items->btValue[12] == 1)// 物品发光
            //                            {
            //                                ClientDealUserItem[K].s.Reserved1 = 1;
            //                            }
            //                            else
            //                            {
            //                                ClientDealUserItem[K].s.Reserved1 = 0;
            //                            }
            //                            if (sUserItemName != "")
            //                            {
            //                                HUtil32.StrToSByteArry(sUserItemName, ClientDealUserItem[K].s.Name, 14, ref ClientDealUserItem[K].s.NameLen);
            //                                //ClientDealUserItem[K].s->Name = sUserItemName;
            //                            }
            //                            ClientDealUserItem[K].MakeIndex = DealOffInfo.UseItems[K].MakeIndex;
            //                            ClientDealUserItem[K].Dura = DealOffInfo.UseItems[K].Dura;
            //                            ClientDealUserItem[K].DuraMax = DealOffInfo.UseItems[K].DuraMax;
            //                            switch (StdItem.StdMode)
            //                            {
            //                                case 15:
            //                                case 19:
            //                                case 26:
            //                                    if (items->btValue[8] != 0)
            //                                    {
            //                                        ClientDealUserItem[K].s.Shape = 130;
            //                                    }
            //                                    break;
            //                                case 60:
            //                                    if ((StdItem.Shape != 0)) // 酒类,除烧酒外
            //                                    {
            //                                        if (items->btValue[0] != 0)
            //                                        {
            //                                            ClientDealUserItem[K].s.AC = items->btValue[0]; // 酒的品质
            //                                        }
            //                                        if (items->btValue[1] != 0)
            //                                        {
            //                                            ClientDealUserItem[K].s.MAC = items->btValue[1]; // 酒的酒精度
            //                                        }
            //                                    }
            //                                    break;
            //                            }
            //                        }
            //                        //sClientDealOffInfo->sDealCharName = DealOffInfo->sDealCharName;
            //                        //sClientDealOffInfo->sBuyCharName = DealOffInfo->sBuyCharName;


            //                        HUtil32.StrToSByteArry(DealOffInfo.sDealCharName,
            //                            sClientDealOffInfo->sDealCharName, 14, ref  sClientDealOffInfo->DealCharNameLen);//出售者

            //                        HUtil32.StrToSByteArry(DealOffInfo.sBuyCharName,
            //                            sClientDealOffInfo->sBuyCharName, 14, ref  sClientDealOffInfo->BuyCharNameLen);//购买者

            //                        sClientDealOffInfo->dSellDateTime = DealOffInfo.dSellDateTime;
            //                        sClientDealOffInfo->nSellGold = DealOffInfo.nSellGold;
            //                        sClientDealOffInfo->N = DealOffInfo.N;
            //                        byte[] data = new byte[sizeof(TClientDealOffInfo)];
            //                        fixed (byte* pb = data) {
            //                            sSendStr = EncryptUnit.EncodeBuffer(data, sizeof(TClientDealOffInfo)); 
            //                        }
            //                        PlayObject.SendMsg(this, Grobal2.RM_QUERYYBSELL, 0, 0, 0, 0, sSendStr);
            //                        break;
            //                    }
            //                }
            //            }
            //        }
            //        else
            //        {
            //            GotoLable(PlayObject, "@AskYBSellFail", false);
            //        }
            //    }
            //    else
            //    {
            //        PlayObject.SendMsg(PlayObject, Grobal2.RM_MENU_OK, 0, PlayObject.m_ActorsId, 0, 0, "您未开通元宝寄售服务,请先开通！！！");
            //    }
            //}
            //catch
            //{
            //    M2Share.MainOutMessage("[异常] TNormNpc.ActionOfQUERYYBSELL");
            //}
        }

        /// <summary>
        /// 功能：(元宝)查询可以的购买物品
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfQueryYbDeal(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            //TDealOffInfo DealOffInfo;
            //string sSendStr;
            //string sUserItemName;
            //TClientDealOffInfo* sClientDealOffInfo = null;
            //TStdItem StdItem;
            //TStdItem StdItem80;
            //TClientItem ClientDealUserItem;
            //TUserItem items = null;
            //bool bo12;
            //try
            //{
            //    if (QuestActionInfo.sParam6 == "88")
            //    {
            //        PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
            //        if (PlayObject == null)
            //        {
            //            return;
            //        }
            //    }
            //    bo12 = false;
            //    if (PlayObject.bo_YBDEAL) // 已开通元宝服务
            //    {
            //        if (PlayObject.SellOffInTime(1))
            //        {
            //            if (M2Share.sSellOffItemList.Count > 0)
            //            {
            //                for (int i = 0; i < M2Share.sSellOffItemList.Count; i++)
            //                {
            //                    DealOffInfo = M2Share.sSellOffItemList[i];
            //                    if (((DealOffInfo.sBuyCharName).CompareTo((PlayObject.m_sCharName).ToLower()) == 0) && (DealOffInfo.N == 0))
            //                    {
            //                        for (int K = 0; K <= 9; K++)
            //                        {
            //                            StdItem = M2Share.UserEngine.GetStdItem(DealOffInfo.UseItems[K].wIndex);
            //                            if (StdItem == null)// 是金刚石
            //                            {
            //                                if (!bo12 && (DealOffInfo.UseItems[K].MakeIndex > 0) && (DealOffInfo.UseItems[K].wIndex == ushort.MaxValue) &&
            //                                    (DealOffInfo.UseItems[K].Dura == ushort.MaxValue)
            //                                    && (DealOffInfo.UseItems[K].DuraMax == ushort.MaxValue))
            //                                {
            //                                    TClientItem* Item = (TClientItem*)sClientDealOffInfo->UseItemsBuff[K];// '金刚石'
            //                                    HUtil32.StrToSByteArry(M2Share.g_Config.sGameDiaMond + "(" + (DealOffInfo.UseItems[K].MakeIndex).ToString() + ")", Item->s.Name, 14, ref Item->s.NameLen);
            //                                    Item->s.Price = DealOffInfo.UseItems[K].MakeIndex; // 金刚石数量
            //                                    Item->Dura = ushort.MaxValue; // 客户端金刚石特征
            //                                    Item->s.DuraMax = ushort.MaxValue; // 客户端金刚石特征
            //                                    Item->s.Looks = ushort.MaxValue; // 不显示图片
            //                                    bo12 = true;
            //                                }
            //                                else
            //                                {
            //                                    ClientDealUserItem = (TClientItem*)sClientDealOffInfo->UseItemsBuff;
            //                                    HUtil32.StrToSByteArry("", ClientDealUserItem.s.Name, 14, ref ClientDealUserItem.s.NameLen);
            //                                }
            //                                continue;
            //                            }
            //                            StdItem80 = StdItem;
            //                            *items = DealOffInfo.UseItems[K];
            //                            M2Share.ItemUnit.GetItemAddValue(items, StdItem80);
            //                            ClientDealUserItem = (TClientItem*)sClientDealOffInfo->UseItemsBuff;
            //                            ClientDealUserItem[K].s = StdItem80;
            //                            sUserItemName = "";// 取自定义物品名称
            //                            if (items->btValue[13] == 1)
            //                            {
            //                                sUserItemName = M2Share.ItemUnit.GetCustomItemName(DealOffInfo.UseItems[K].MakeIndex, DealOffInfo.UseItems[K].wIndex);
            //                            }
            //                            if (items->btValue[12] == 1)// 物品发光
            //                            {
            //                                ClientDealUserItem[K].s.Reserved1 = 1;
            //                            }
            //                            else
            //                            {
            //                                ClientDealUserItem[K].s.Reserved1 = 0;
            //                            }
            //                            if (sUserItemName != "")
            //                            {
            //                                HUtil32.StrToSByteArry(sUserItemName, ClientDealUserItem[K].s.Name, 14, ref ClientDealUserItem[K].s.NameLen);
            //                                //ClientDealUserItem[K].s->Name = sUserItemName;
            //                            }
            //                            ClientDealUserItem[K].MakeIndex = DealOffInfo.UseItems[K].MakeIndex;
            //                            ClientDealUserItem[K].Dura = DealOffInfo.UseItems[K].Dura;
            //                            ClientDealUserItem[K].DuraMax = DealOffInfo.UseItems[K].DuraMax;
            //                            switch (StdItem.StdMode)
            //                            {
            //                                case 15:
            //                                case 19:
            //                                case 26:
            //                                    if (items->btValue[8] != 0)
            //                                    {
            //                                        ClientDealUserItem[K].s.Shape = 130;
            //                                    }
            //                                    break;
            //                                case 60:
            //                                    if ((StdItem.Shape != 0))  // 酒类,除烧酒外
            //                                    {
            //                                        if (items->btValue[0] != 0)
            //                                        {
            //                                            ClientDealUserItem[K].s.AC = items->btValue[0];  // 酒的品质
            //                                        }
            //                                        if (items->btValue[1] != 0)
            //                                        {
            //                                            ClientDealUserItem[K].s.MAC = items->btValue[1];   // 酒的酒精度
            //                                        }
            //                                    }
            //                                    break;
            //                            }
            //                        }
            //                        HUtil32.StrToSByteArry(DealOffInfo.sDealCharName,
            //                            sClientDealOffInfo->sDealCharName, 14, ref  sClientDealOffInfo->DealCharNameLen);//出售者
            //                        HUtil32.StrToSByteArry(DealOffInfo.sBuyCharName,
            //                            sClientDealOffInfo->sBuyCharName, 14, ref  sClientDealOffInfo->BuyCharNameLen);//购买者
            //                        sClientDealOffInfo->dSellDateTime = DealOffInfo.dSellDateTime;
            //                        sClientDealOffInfo->nSellGold = DealOffInfo.nSellGold;
            //                        sClientDealOffInfo->N = DealOffInfo.N;
            //                        byte[] data = new byte[sizeof(TClientDealOffInfo)];
            //                        fixed (byte* pb = data) {
            //                            *(TClientDealOffInfo*)pb = *sClientDealOffInfo;
            //                        }
            //                        sSendStr = EncryptUnit.EncodeBuffer(data, sizeof(TClientDealOffInfo));
            //                        PlayObject.SendMsg(this, Grobal2.RM_QUERYYBDEAL, 0, 0, 0, 0, sSendStr);
            //                        break;
            //                    }
            //                }
            //            }
            //        }
            //        else
            //        {
            //            GotoLable(PlayObject, "@AskYBDealFail", false);
            //        }
            //    }
            //    else
            //    {
            //        PlayObject.SendMsg(PlayObject, Grobal2.RM_MENU_OK, 0, PlayObject.m_ActorsId, 0, 0, "您未开通元宝寄售服务,请先开通！！！");
            //    }
            //}
            //catch
            //{
            //    M2Share.MainOutMessage("[异常] TNormNpc.ActionOfQUERYYBDEAL");
            //}
        }

        /// <summary>
        /// 功能：改变穿人模式
        /// THROUGHHUM M S M:模式[-1=恢复/0=穿人穿怪/1=穿怪/2=穿人] S:时间(秒)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfTHROUGHHUM(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nMode;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nMode = QuestActionInfo.nParam1;// 模式[-1=恢复/0=穿人穿怪/1=穿怪/2=穿人]
                PlayObject.dwRunHumanModeTime = Convert.ToUInt32(QuestActionInfo.nParam2 * 1000);
                switch (nMode)
                {
                    case -1:// 时间(秒)
                        M2Share.g_Config.boRUNHUMAN = M2Share.ServerConfig.GetConfig<bool>("Setup", "RunHuman", M2Share.g_Config.boRUNHUMAN);
                        M2Share.g_Config.boRUNMON = M2Share.ServerConfig.GetConfig<bool>("Setup", "RunMon", M2Share.g_Config.boRUNMON);
                        break;
                    case 0:
                        M2Share.g_Config.boRUNHUMAN = true;// 穿人
                        M2Share.g_Config.boRUNMON = true;// 穿怪
                        PlayObject.dwRunHumanModeTick = HUtil32.GetTickCount();
                        PlayObject.m_boRunHumanMode = true;
                        break;
                    case 1:
                        M2Share.g_Config.boRUNMON = true;// 穿怪
                        PlayObject.dwRunHumanModeTick = HUtil32.GetTickCount();
                        PlayObject.m_boRunHumanMode = true;
                        break;
                    case 2:
                        M2Share.g_Config.boRUNHUMAN = true;// 穿人
                        PlayObject.dwRunHumanModeTick = HUtil32.GetTickCount();
                        PlayObject.m_boRunHumanMode = true;
                        break;
                }
                PlayObject.SendServerConfig();// 发送配置信息到客户端
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfTHROUGHHUM");
            }
        }

        /// <summary>
        /// 功能：装备发光设置  
        /// 格式:SetItemsLight 装备位置(0-12) 是否发光(1发光，0不发光)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfSetItemsLight(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nItem;
            int nLight;
            TUserItem UserItem;
            TStdItem StdItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nItem = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);// 装备位置
                nLight = HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0);// 是否发光
                if (nItem < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nItem);
                }
                if (nLight < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nLight);
                }
                if ((nItem < 0) || (nItem > m_UseItems.GetUpperBound(0)) || (new ArrayList(new int[] { 0, 1 }).Contains(~nLight)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSETITEMSLIGHT);
                    return;
                }
                UserItem = PlayObject.m_UseItems[nItem];
                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                if ((UserItem.wIndex <= 0) || (StdItem == null))
                {
                    // PlayObject.SysMsg('你身上没有戴指定物品！！！', c_Red, t_Hint);
                    return;
                }
                UserItem.btValue[12] = (byte)nLight;
                PlayObject.SendUpdateItem(UserItem);// 更新物品
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSetItemsLight");
            }
        }

        /// <summary>
        /// 功能：打开卧龙宝藏   
        /// 格式:OpenDragonBoxs 5  打开5类型的宝箱
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfOpenDragonBox(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nItem = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);// 宝箱类型
                if (nItem < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nItem);
                }
                if (nItem < 0)
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sOPENDRAGONBOX);
                    return;
                }
                if (PlayObject.ClientOpenBoxs(nItem))// 宝箱开启
                {
                    PlayObject.SendMsg(this, Grobal2.RM_OPENDRAGONBOXS, 0, 0, 0, 0, "");
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfOpenDragonBox");
            }
        }

        /// <summary>
        /// 功能：打开淬炼功能窗口
        /// 格式: QUERYREFINEITEM
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfQUERYREFINEITEM(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((!PlayObject.m_boDeath) && (!PlayObject.m_boGhost))
                {
                    PlayObject.SendMsg(this, Grobal2.RM_QUERYREFINEITEM, 0, 0, 0, 0, "");
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfQUERYREFINEITEM");
            }
        }

        /// <summary>
        /// 功能：移动到回城点 
        /// 格式: GOHOME
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGOHOME(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((!PlayObject.m_boDeath) && (!PlayObject.m_boGhost))
                {
                    PlayObject.MoveToHome();// 移动到回城点
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGOHOME");
            }
        }

        public bool ActionOfTHROWITEM_GetDropRandomPosition(int nOrgX, int nOrgY, int nRange, ref int nDX, ref int nDY)
        {
            bool result = false;
            int nItemCount = 0;
            int n24;
            int n28;
            int n2C;
            n24 = 999;
            result = false;
            n28 = 0;
            n2C = 0;
            for (int i = 1; i <= nRange; i++)
            {
                for (int II = -i; II <= i; II++)
                {
                    for (int III = -i; III <= i; III++)
                    {
                        nDX = nOrgX + HUtil32.Random(nRange) + III;
                        nDY = nOrgY + HUtil32.Random(nRange) + II;
                        if (this.m_PEnvir.GetItemEx(nDX, nDY, ref nItemCount) == null)
                        {
                            if (this.m_PEnvir.bo2C)
                            {
                                result = true;
                                break;
                            }
                        }
                        else
                        {
                            if (this.m_PEnvir.bo2C && (n24 > nItemCount))
                            {
                                n24 = nItemCount;
                                n28 = nDX;
                                n2C = nDY;
                            }
                        }
                    }
                    if (result)
                    {
                        break;
                    }
                }
                if (result)
                {
                    break;
                }
            }
            if (!result)
            {
                if (n24 < 8)
                {
                    nDX = n28;
                    nDY = n2C;
                }
                else
                {
                    nDX = nOrgX;
                    nDY = nOrgY;
                }
            }
            return result;
        }

        /// <summary>
        /// 功能：将指定物品刷新到指定地图坐标范围内
        /// 格式：THROWITEM 地图 X Y 范围 物品名称 数量
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfTHROWITEM(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sMap;
            string sItemName;
            string sUserItemName;

            int idura = 0;
            int nX = 0;
            int nY = 0;
            int nRange = 0;
            int nCount = 0;
            int dX = 0;
            int dY = 0;
            Envirnoment Envir;
            TMapItem MapItem;
            TMapItem pr = null;
            TStdItem StdItem;
            TUserItem UserItem = null;
            try
            {
                // ----------------------------------------------------------------------------------------
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                // ======================================================================
                sMap = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 地图 支持变量
                nX = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);// X 支持变量
                nY = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);// Y 支持变量
                nRange = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam4), -1);// 范围 支持变量
                sItemName = GetLineVariableText(PlayObject, QuestActionInfo.sParam5);// 物品名称 支持变量
                nCount = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam6), -1);// 数量 支持变量
                if ((sMap == "") || (nX < 0) || (nY < 0) || (nRange < 0) || (sItemName == "") || (nCount <= 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sTHROWITEM);
                    return;
                }
                Envir = M2Share.g_MapManager.FindMap(sMap);// 查找地图,地图不存在则退出
                if (Envir == null)
                {
                    return;
                }
                if (nCount <= 0)
                {
                    nCount = 1;
                }
                for (var i = 0; i < nCount; i++)
                {
                    UserItem = new TUserItem();
                    if (M2Share.UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                    {
                        if (this.CheckItemValue(UserItem, 5))
                        {
                            return;
                        }
                        // 是否禁止爆出
                        StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                        if (StdItem != null)
                        {
                            if (StdItem.StdMode == 40)
                            {
                                idura = UserItem.Dura;
                                idura = idura - 2000;
                                if (idura < 0)
                                {
                                    idura = 0;
                                }
                                UserItem.Dura = (ushort)idura;
                            }
                            MapItem = new TMapItem();
                            MapItem.UserItem = UserItem;
                            MapItem.Name = StdItem.Name;// 取自定义物品名称
                            sUserItemName = "";
                            if (UserItem.btValue[13] == 1)
                            {
                                sUserItemName = M2Share.ItemUnit.GetCustomItemName(UserItem.MakeIndex, UserItem.wIndex);
                                if (sUserItemName != "")
                                {
                                    MapItem.Name = sUserItemName;
                                }
                            }
                            MapItem.Looks = StdItem.Looks;
                            if (StdItem.StdMode == 45)
                            {
                                MapItem.Looks = (ushort)M2Share.GetRandomLook(MapItem.Looks, StdItem.Shape);
                            }
                            MapItem.AniCount = StdItem.AniCount;
                            MapItem.Reserved = 0;
                            MapItem.Count = 1;
                            MapItem.OfBaseObject = null;
                            MapItem.dwCanPickUpTick = HUtil32.GetTickCount();
                            MapItem.DropBaseObject = null;
                            ActionOfTHROWITEM_GetDropRandomPosition(nX, nY, nRange, ref dX, ref dY);//取掉物品的位置
                            pr = (TMapItem)Envir.AddToMap(dX, dY, Grobal2.OS_ITEMOBJECT, MapItem);
                            if (pr == MapItem)
                            {
                                this.SendRefMsg(Grobal2.RM_ITEMSHOW, MapItem.Looks, MapItem.ItemId, dX, dY, MapItem.Name);
                            }
                            else
                            {
                                Dispose(MapItem);
                                break;
                            }
                        }
                    }
                    else
                    {
                        UserItem = null;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfTHROWITEM");
            }
        }

        /// <summary>
        /// 功能: 删除指定文本里的编码
        /// 格式: CLEARCODELIST 玩家变量 文本路径
        /// 例子: CLEARCODELIST <$STR(S1)> ..\questdiary\冲值\500元卡号.txt
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCLEARCODELIST(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TStringList LoadList = null;
            string sPlayID;
            string sLine;
            string sFileName;
            try
            {
                try
                {
                    if (QuestActionInfo.sParam6 == "88")
                    {
                        PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                        if (PlayObject == null)
                        {
                            return;
                        }
                    }
                    sPlayID = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                    if ((sPlayID == ""))
                    {
                        ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref sPlayID);
                    }
                    sFileName = QuestActionInfo.sParam2;// 文本路径
                    if (sFileName[0] == '\\')
                    {
                        sFileName = sFileName.Substring(2 - 1, sFileName.Length - 1);
                    }
                    if (sFileName[1] == '\\')
                    {
                        sFileName = sFileName.Substring(3 - 1, sFileName.Length - 2);
                    }
                    if (sFileName[2] == '\\')
                    {
                        sFileName = sFileName.Substring(4 - 1, sFileName.Length - 3);
                    }
                    sFileName = M2Share.g_Config.sEnvirDir + sFileName;
                    LoadList = new TStringList();
                    if (File.Exists(sFileName))
                    {
                        LoadList.LoadFromFile(sFileName);
                        if (LoadList.Count > 0)
                        {
                            for (int i = 0; i < LoadList.Count; i++)
                            {
                                sLine = LoadList[i].Trim();
                                if ((sLine == "") || (sLine[0] == ';'))
                                {
                                    continue;
                                }
                                if ((sLine).ToLower().CompareTo((sPlayID).ToLower()) == 0)
                                {
                                    LoadList.RemoveAt(i);
                                    LoadList.SaveToFile(sFileName);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sCLEARCODELIST);
                    }
                }
                finally
                {

                    Dispose(LoadList);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCLEARCODELIST");
            }
        }

        public bool ActionOfGetRandomName_GetValNameValue(TPlayObject PlayObject, string sVarName, ref string sValue, ref int nValue, ref int nDataType)
        {
            bool result = false;
            nValue = -1;
            sValue = "";
            nDataType = -1;
            int n100 = M2Share.GetValNameNo(sVarName);
            if (n100 >= 0)
            {
                if (HUtil32.rangeInDefined(n100, 0, 99))
                {
                    nValue = PlayObject.m_nVal[n100];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 100, 199))
                {
                    nValue = M2Share.g_Config.GlobalVal[n100 - 100];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 200, 299))
                {
                    nValue = PlayObject.m_DyVal[n100 - 200];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 300, 399))
                {
                    nValue = PlayObject.m_nMval[n100 - 300];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 400, 499))
                {
                    nValue = M2Share.g_Config.GlobaDyMval[n100 - 400];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 500, 599))
                {
                    nValue = PlayObject.m_nInteger[n100 - 500];
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 600, 699))
                {
                    sValue = PlayObject.m_sString[n100 - 600];
                    nDataType = 0;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 700, 799))
                {
                    sValue = M2Share.g_Config.GlobalAVal[n100 - 700];
                    nDataType = 0;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 800, 1199))
                {
                    nValue = M2Share.g_Config.GlobalVal[n100 - 700];//G变量
                    nDataType = 1;
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 1200, 1599))
                {
                    sValue = M2Share.g_Config.GlobalAVal[n100 - 1100];// A变量
                    nDataType = 0;
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            else
            {
                result = false;
            }
            return result;
        }

        public bool ActionOfGetRandomName_SetValNameValue(TPlayObject PlayObject, string sVarName, string sValue, int nValue, int nDataType)
        {
            bool result = false;
            int n100 = M2Share.GetValNameNo(sVarName);
            if (n100 >= 0)
            {
                switch (nDataType)
                {
                    case 1:
                        if (HUtil32.rangeInDefined(n100, 0, 99))
                        {
                            PlayObject.m_nVal[n100] = nValue;
                            result = true;
                            break;
                        }
                        else if (HUtil32.rangeInDefined(n100, 100, 199))
                        {
                            M2Share.g_Config.GlobalVal[n100 - 100] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 200, 299))
                        {
                            PlayObject.m_DyVal[n100 - 200] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 300, 399))
                        {
                            PlayObject.m_nMval[n100 - 300] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 400, 499))
                        {
                            M2Share.g_Config.GlobaDyMval[n100 - 400] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 500, 599))
                        {
                            PlayObject.m_nInteger[n100 - 500] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 800, 1199))// G变量
                        {
                            M2Share.g_Config.GlobalVal[n100 - 700] = nValue;
                            result = true;
                        }
                        else
                        {
                            result = false;
                        }
                        break;
                    case 0:
                        if (HUtil32.rangeInDefined(n100, 600, 699))
                        {
                            PlayObject.m_sString[n100 - 600] = sValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 700, 799))
                        {
                            M2Share.g_Config.GlobalAVal[n100 - 700] = sValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 1200, 1599))//A变量(100-499)
                        {
                            M2Share.g_Config.GlobalAVal[n100 - 1100] = sValue;
                            result = true;
                        }
                        else
                        {
                            result = false;
                        }
                        break;
                    case 3:
                        if (HUtil32.rangeInDefined(n100, 0, 99))
                        {
                            PlayObject.m_nVal[n100] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 100, 199))
                        {
                            M2Share.g_Config.GlobalVal[n100 - 100] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 200, 299))
                        {
                            PlayObject.m_DyVal[n100 - 200] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 300, 399))
                        {
                            PlayObject.m_nMval[n100 - 300] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 400, 499))
                        {
                            M2Share.g_Config.GlobaDyMval[n100 - 400] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 500, 599))
                        {
                            PlayObject.m_nInteger[n100 - 500] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 600, 699))
                        {
                            PlayObject.m_sString[n100 - 600] = sValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 700, 799))
                        {
                            M2Share.g_Config.GlobalAVal[n100 - 700] = sValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 800, 1199))//G变量
                        {
                            M2Share.g_Config.GlobalVal[n100 - 700] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 1200, 1599))//A变量
                        {
                            M2Share.g_Config.GlobalAVal[n100 - 1100] = sValue;
                            result = true;
                        }
                        else
                        {
                            result = false;

                        }
                        break;
                }
            }
            else
            {
                result = false;
            }
            return result;
        }

        /// <summary>
        /// 功能: 从文件中随机取文本   格式：GetRandomName 文本(全路径) 字符串变量
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGetRandomName(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TStringList LoadList;
            string sFileName;
            string MonName;
            string sValue = string.Empty;
            string sParam2 = string.Empty;
            int K = 0;
            int nValue = 0;
            int nDataType = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                MonName = "";
                if (HUtil32.CompareLStr(QuestActionInfo.sParam2, "<$STR(", 6))
                {
                    HUtil32.ArrestStringEx(QuestActionInfo.sParam2, "(", ")", ref sParam2);
                }
                else
                {
                    sParam2 = QuestActionInfo.sParam2;
                }
                sFileName = QuestActionInfo.sParam1;// 文本(全路径)
                if (sFileName[0] == '\\')
                {
                    sFileName = sFileName.Substring(2 - 1, sFileName.Length - 1);
                }
                if (sFileName[1] == '\\')
                {
                    sFileName = sFileName.Substring(3 - 1, sFileName.Length - 2);
                }
                if (sFileName[2] == '\\')
                {
                    sFileName = sFileName.Substring(4 - 1, sFileName.Length - 3);
                }
                sFileName = GetLineVariableText(PlayObject, sFileName);// 文件路径支持变量
                sFileName = M2Share.g_Config.sEnvirDir + sFileName;
                if (File.Exists(sFileName))
                {
                    LoadList = new TStringList();
                    try
                    {
                        LoadList.LoadFromFile(sFileName);
                        if (LoadList.Count > 0)
                        {
                            for (var i = 0; i < LoadList.Count; i++)
                            {
                                K = HUtil32.Random(LoadList.Count);
                                MonName = LoadList[K];
                                if (MonName != "")
                                {
                                    break;
                                }
                            }
                        }
                    }
                    finally
                    {

                        Dispose(LoadList);
                    }
                }
                if (MonName != "")
                {
                    // 传值过程
                    if (ActionOfGetRandomName_GetValNameValue(PlayObject, sParam2, ref sValue, ref nValue, ref nDataType))
                    {
                        if (!ActionOfGetRandomName_SetValNameValue(PlayObject, sParam2, MonName, nValue, nDataType))
                        {
                            ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sGETRANDOMNAME);
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGetRandomName");
            }
        }

        /// <summary>
        /// 功能: 通过脚本命令让别人执行QManage.txt中的脚本 
        /// 格式：HCall 人物名称 标签
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfHCall(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TPlayObject User;
            string UserName;
            string sLable;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                UserName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 人物名称 支持变量
                sLable = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);// 标签 支持变量
                if ((UserName == "") || (sLable == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sHCall);
                    return;
                }
                User = M2Share.UserEngine.GetPlayObject(UserName);
                if (User != null)
                {
                    if (M2Share.g_ManageNPC != null)
                    {
                        M2Share.g_ManageNPC.GotoLable(User, sLable, false);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfHCall");
            }
        }

        // -----------------------------------------------------------------------------
        /// <summary>
        /// 功能: 检测人物是否在攻城期间的范围内，在则BB叛变
        /// 格式：INCASTLEWARAY
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfINCASTLEWARAY(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserCastle Castle;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Castle = M2Share.g_CastleManager.InCastleWarArea(PlayObject);
                if ((Castle != null) && Castle.m_boUnderWar)
                {
                    if (PlayObject.m_SlaveList.Count > 0)
                    {
                        for (int i = PlayObject.m_SlaveList.Count - 1; i >= 0; i--)
                        {
                            if (PlayObject.m_SlaveList.Count <= 0)
                            {
                                break;
                            }
                            if (PlayObject.m_SlaveList[i].m_btRaceServer != Grobal2.RC_PLAYMOSTER)
                            {
                                PlayObject.m_SlaveList[i].m_dwMasterRoyaltyTick = 0;
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfINCASTLEWARAY");
            }
        }

        /// <summary>
        /// 功能：给予带绑定状态装备。主要方便设置不能配带的装备绑定状态
        /// 格式： GIVESTATEITEM 物品名称 项目1 项目2 项目3 项目4 项目5 项目6(0为正常,1为绑定) 
        /// 项目1--给予禁止扔，项目2--禁止交易，项目3--禁止存，项目4--禁止修，项目5--禁止出售,项目6--禁止爆出的装备
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfGIVESTATEITEM(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sItmeName;
            byte n1;
            byte n2;
            byte n3;
            byte n4;
            byte n5;
            byte n6;
            TUserItem UserItem;
            TStdItem StdItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sItmeName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 物品名称 支持变量
                n1 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);// 项目1 支持变量
                n2 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);// 项目2 支持变量
                n3 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam4), -1);// 项目3 支持变量
                n4 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam5), -1);// 项目4 支持变量
                n5 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam6), -1);// 项目5 支持变量
                n6 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam7), -1);// 项目6 支持变量
                if ((!(new ArrayList(new int[] { 0, 1 }).Contains(n1))) || (!(new ArrayList(new int[] { 0, 1 }).Contains(n2))) || (!(new ArrayList(new int[] { 0, 1 }).Contains(n3))) ||
                    (!(new ArrayList(new int[] { 0, 1 }).Contains(n4))) || (!(new ArrayList(new int[] { 0, 1 }).Contains(n5))) || (!(new ArrayList(new int[] { 0, 1 }).Contains(n6))) || (sItmeName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sGIVESTATEITEM);
                    return;
                }
                if (PlayObject.m_ItemList.Count > 0)
                {
                    for (int i = 0; i < PlayObject.m_ItemList.Count; i++)// 人物包裹不为空
                    {
                        UserItem = (TUserItem)PlayObject.m_ItemList[i];
                        StdItem = M2Share.UserEngine.GetStdItem(sItmeName);
                        if ((StdItem != null) && (UserItem.wIndex > 0))
                        {
                            UserItem.btValue[14] = n1;
                            UserItem.btValue[15] = n2;
                            UserItem.btValue[16] = n3;
                            UserItem.btValue[17] = n4;
                            UserItem.btValue[18] = n5;
                            UserItem.btValue[19] = n6;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGIVESTATEITEM");
            }
        }

        /// <summary>
        /// 功能：设置装备绑定状态。
        /// 格式：SETITEMSTATE 位置(0-13) 项目(0-5) 属性(0为正常,1为绑定)
        /// 项目: 0 禁止扔1 禁止交易 2 禁止存 3 禁止修 4 禁止出售 5 禁止爆出
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfSETITEMSTATE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            byte n1;
            byte n2;
            byte n3;
            TUserItem UserItem = null;
            TStdItem StdItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                n1 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), -1);// 位置 支持变量
                n2 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);// 项目 支持变量
                n3 = (byte)HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);// 属性 支持变量
                if ((!(n1 >= 0 && n1 <= 13)) || (!(n2 >= 0 && n2 <= 5)) || (!(new ArrayList(new int[] { 0, 1 }).Contains(n3))))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSETITEMSTATE);
                    return;
                }
                UserItem = PlayObject.m_UseItems[n1];
                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                if ((UserItem.wIndex <= 0) || (StdItem == null))
                {
                    // PlayObject.SysMsg('你身上没有戴指定物品！！！', c_Red, t_Hint);
                    return;
                }
                switch (n2)
                {
                    case 0:
                        // 项目
                        UserItem.btValue[14] = n3;
                        break;
                    case 1:
                        UserItem.btValue[15] = n3;
                        break;
                    case 2:
                        UserItem.btValue[16] = n3;
                        break;
                    case 3:
                        UserItem.btValue[17] = n3;
                        break;
                    case 4:
                        UserItem.btValue[18] = n3;
                        break;
                    case 5:
                        UserItem.btValue[19] = n3;
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSETITEMSTATE");
            }
        }

        private void ActionOfMarry(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TPlayObject PoseHuman;
            string sSayMsg;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.m_sDearName != "")
                {
                    return;
                }
                PoseHuman = ((TPlayObject)(PlayObject.GetPoseCreate()));
                if (PoseHuman == null)
                {
                    GotoLable(PlayObject, "@MarryCheckDir", false);
                    return;
                }
                if (QuestActionInfo.sParam1 == "")
                {
                    if (PoseHuman.m_btRaceServer != Grobal2.RC_PLAYOBJECT)
                    {
                        GotoLable(PlayObject, "@HumanTypeErr", false);
                        return;
                    }
                    if (PoseHuman.GetPoseCreate() == PlayObject)
                    {
                        if (PlayObject.m_btGender != PoseHuman.m_btGender)
                        {
                            GotoLable(PlayObject, "@StartMarry", false);
                            GotoLable(PoseHuman, "@StartMarry", false);
                            if ((PlayObject.m_btGender == 0) && (PoseHuman.m_btGender == 1))
                            {
                                sSayMsg = GameMsgDef.g_sStartMarryManMsg.Replace("%n", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                                M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                                sSayMsg = GameMsgDef.g_sStartMarryManAskQuestionMsg.Replace("%n", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                                M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                            }
                            else if ((PlayObject.m_btGender == 1) && (PoseHuman.m_btGender == 0))
                            {
                                sSayMsg = GameMsgDef.g_sStartMarryWoManMsg.Replace("%n", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                                M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                                sSayMsg = GameMsgDef.g_sStartMarryWoManAskQuestionMsg.Replace("%n", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                                M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                            }
                            PlayObject.m_boStartMarry = true;
                            PoseHuman.m_boStartMarry = true;
                        }
                        else
                        {
                            GotoLable(PoseHuman, "@MarrySexErr", false);
                            GotoLable(PlayObject, "@MarrySexErr", false);
                        }
                    }
                    else
                    {
                        GotoLable(PlayObject, "@MarryDirErr", false);
                        GotoLable(PoseHuman, "@MarryCheckDir", false);
                    }
                    return;
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("REQUESTMARRY").ToLower()) == 0)
                {
                    if (PlayObject.m_boStartMarry && PoseHuman.m_boStartMarry)
                    {
                        if ((PlayObject.m_btGender == 0) && (PoseHuman.m_btGender == 1))
                        {
                            sSayMsg = GameMsgDef.g_sMarryManAnswerQuestionMsg.Replace("%n", this.m_sCharName);
                            sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                            sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                            M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                            sSayMsg = GameMsgDef.g_sMarryManAskQuestionMsg.Replace("%n", this.m_sCharName);
                            sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                            sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                            M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                            GotoLable(PlayObject, "@WateMarry", false);
                            GotoLable(PoseHuman, "@RevMarry", false);
                        }
                    }
                    return;
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("RESPONSEMARRY").ToLower()) == 0)
                {
                    if ((PlayObject.m_btGender == 1) && (PoseHuman.m_btGender == 0))
                    {
                        if ((QuestActionInfo.sParam2).ToLower().CompareTo(("OK").ToLower()) == 0)
                        {
                            if (PlayObject.m_boStartMarry && PoseHuman.m_boStartMarry)
                            {
                                sSayMsg = GameMsgDef.g_sMarryWoManAnswerQuestionMsg.Replace("%n", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                                M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                                sSayMsg = GameMsgDef.g_sMarryWoManGetMarryMsg.Replace("%n", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                                M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                                GotoLable(PlayObject, "@EndMarry", false);
                                GotoLable(PoseHuman, "@EndMarry", false);
                                PlayObject.m_boStartMarry = false;
                                PoseHuman.m_boStartMarry = false;
                                PlayObject.m_sDearName = PoseHuman.m_sCharName;
                                PlayObject.m_DearHuman = PoseHuman;
                                PoseHuman.m_sDearName = PlayObject.m_sCharName;
                                PoseHuman.m_DearHuman = PlayObject;
                                PlayObject.RefShowName();
                                PoseHuman.RefShowName();
                            }
                        }
                        else
                        {
                            if (PlayObject.m_boStartMarry && PoseHuman.m_boStartMarry)
                            {
                                GotoLable(PlayObject, "@EndMarryFail", false);
                                GotoLable(PoseHuman, "@EndMarryFail", false);
                                PlayObject.m_boStartMarry = false;
                                PoseHuman.m_boStartMarry = false;
                                sSayMsg = GameMsgDef.g_sMarryWoManDenyMsg.Replace("%n", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                                M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                                sSayMsg = GameMsgDef.g_sMarryWoManCancelMsg.Replace("%n", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%s", PlayObject.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%d", PoseHuman.m_sCharName);
                                M2Share.UserEngine.SendBroadCastMsg(sSayMsg, TMsgType.t_Say);
                            }
                        }
                    }
                    return;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMarry");
            }
        }

        /// <summary>
        /// 功能：收徒或拜师
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfMaster(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TPlayObject PoseHuman;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.m_sMasterName != "")
                {
                    return;
                }
                PoseHuman = ((TPlayObject)(PlayObject.GetPoseCreate()));
                if (PoseHuman == null)
                {
                    GotoLable(PlayObject, "@MasterCheckDir", false);
                    return;
                }
                if (QuestActionInfo.sParam1 == "")
                {
                    if (PoseHuman.m_btRaceServer != Grobal2.RC_PLAYOBJECT)
                    {
                        GotoLable(PlayObject, "@HumanTypeErr", false);
                        return;
                    }
                    if (PoseHuman.GetPoseCreate() == PlayObject)
                    {
                        GotoLable(PlayObject, "@StartGetMaster", false);
                        GotoLable(PoseHuman, "@StartMaster", false);
                        PlayObject.m_boStartMaster = true;
                        PoseHuman.m_boStartMaster = true;
                    }
                    else
                    {
                        GotoLable(PlayObject, "@MasterDirErr", false);
                        GotoLable(PoseHuman, "@MasterCheckDir", false);
                    }
                    return;
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("REQUESTMASTER").ToLower()) == 0)
                {
                    if (PlayObject.m_boStartMaster && PoseHuman.m_boStartMaster)
                    {
                        PlayObject.m_PoseBaseObject = PoseHuman;
                        PoseHuman.m_PoseBaseObject = PlayObject;
                        GotoLable(PlayObject, "@WateMaster", false);
                        GotoLable(PoseHuman, "@RevMaster", false);
                    }
                    return;
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("RESPONSEMASTER").ToLower()) == 0)
                {
                    if ((QuestActionInfo.sParam2).ToLower().CompareTo(("OK").ToLower()) == 0)
                    {
                        if ((PlayObject.m_PoseBaseObject == PoseHuman) && (PoseHuman.m_PoseBaseObject == PlayObject))
                        {
                            if ((PlayObject.m_MasterNoList.Count >= M2Share.g_Config.nMasterCount))  // 超过可收徒弟数,则退出
                            {
                                GotoLable(PoseHuman, "@EndMasterFail", false);// 提示拜师失败
                                GotoLable(PlayObject, "@EndMasterFail", false);// 提示拜师失败
                                return;
                            }
                            if (PlayObject.m_boStartMaster && PoseHuman.m_boStartMaster)
                            {
                                GotoLable(PlayObject, "@EndMaster", false);
                                GotoLable(PoseHuman, "@EndMaster", false);
                                PlayObject.m_boStartMaster = false;
                                PoseHuman.m_boStartMaster = false;
                                PlayObject.m_boMaster = true;
                                PlayObject.AddMaster(PoseHuman.m_sCharName);// 收徒
                                PlayObject.m_MasterList.Add(PoseHuman);
                                PoseHuman.m_sMasterName = PlayObject.m_sCharName;
                                PoseHuman.m_boMaster = false;
                                PoseHuman.GetMasterNoList();// 取排名
                                PlayObject.RefShowName();
                                PoseHuman.RefShowName();
                            }
                        }
                    }
                    else
                    {
                        if (PlayObject.m_boStartMaster && PoseHuman.m_boStartMaster)
                        {
                            GotoLable(PlayObject, "@EndMasterFail", false);
                            GotoLable(PoseHuman, "@EndMasterFail", false);
                            PlayObject.m_boStartMaster = false;
                            PoseHuman.m_boStartMaster = false;
                        }
                    }
                    return;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMaster");
            }
        }

        /// <summary>
        /// 功能：游戏对话框
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfMessageBox(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sParam1 = string.Empty;
            string Str;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sParam1 = QuestActionInfo.sParam1;
                ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref sParam1);
                Str = GetLineVariableText(PlayObject, sParam1);
                if ((QuestActionInfo.sParam2 != "") && (QuestActionInfo.sParam2.IndexOf("@") > 0))
                {
                    Str = Str + "/" + QuestActionInfo.sParam2;
                }
                if ((QuestActionInfo.sParam3 != "") && (QuestActionInfo.sParam3.IndexOf("@") > 0))
                {
                    Str = Str + "/" + QuestActionInfo.sParam3;
                }
                PlayObject.SendMsg(this, Grobal2.RM_MENU_OK, 0, PlayObject.m_ActorsId, 0, 0, Str);
                PlayObject.m_nUserCmdNPC = this;// 新添加 需测试
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMessageBox");
            }
        }

        private void ActionOfMission(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((QuestActionInfo.sParam1 != "") && (QuestActionInfo.nParam2 > 0) && (QuestActionInfo.nParam3 > 0))
                {
                    M2Share.g_sMissionMap = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                    M2Share.g_nMissionX = QuestActionInfo.nParam2;
                    M2Share.g_nMissionY = QuestActionInfo.nParam3;
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_MISSION);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMission");
            }
        }

        /// <summary>
        /// 功能：安全区光环设置
        /// 命令格式: MOBFIREBURN MAP X Y TYPE TIME POINT
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfMobFireBurn(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sMAP;
            int nX;
            int nY;
            int nType;
            int nTime;
            int nPoint;
            TFireBurnEvent FireBurnEvent;
            Envirnoment Envir;
            Envirnoment OldEnvir;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sMAP = QuestActionInfo.sParam1;
                nX = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                nY = HUtil32.Str_ToInt(QuestActionInfo.sParam3, -1);
                nType = HUtil32.Str_ToInt(QuestActionInfo.sParam4, -1);
                nTime = HUtil32.Str_ToInt(QuestActionInfo.sParam5, -1);
                nPoint = HUtil32.Str_ToInt(QuestActionInfo.sParam6, -1);
                if ((sMAP == "") || (nX < 0) || (nY < 0) || (nType < 0) || (nTime < 0) || (nPoint < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_MOBFIREBURN);
                    return;
                }
                Envir = M2Share.g_MapManager.FindMap(sMAP);
                if (Envir != null)
                {
                    OldEnvir = PlayObject.m_PEnvir;
                    PlayObject.m_PEnvir = Envir;
                    FireBurnEvent = new TFireBurnEvent(PlayObject, nX, nY, nType, Convert.ToUInt32(nTime * 1000), nPoint);
                    M2Share.g_EventManager.AddEvent(FireBurnEvent);
                    PlayObject.m_PEnvir = OldEnvir;
                    return;
                }
                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_MOBFIREBURN);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMobFireBurn");
            }
        }

        /// <summary>
        /// 放置怪物，怪物向集中点集中
        /// 命令格式: MobPlace 怪物名称 是否内功怪 模式(0/1 1-魔王岭新模式)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <param name="nCount"></param>
        /// <param name="nRange"></param>
        private void ActionOfMobPlace(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo, int nX, int nY, int nCount, int nRange)
        {
            int nRandX;
            int nRandY;
            TBaseObject mon;
            string sMonName;
            bool boIsNGMon;
            bool boMode = false;// 是否新模式
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sMonName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 怪物名,支持变量
                boIsNGMon = HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0) != 0;
                if (QuestActionInfo.sParam3 != "")
                {
                    boMode = true;
                }
                if (nCount <= 0)
                {
                    nCount = 1;
                }
                for (int i = 0; i < nCount; i++)
                {
                    if (boMode && (PlayObject.m_sMapName136 != ""))// 魔王岭使用
                    {
                        mon = M2Share.UserEngine.RegenMonsterByName(PlayObject.m_sMapName136, M2Share.UserEngine.m_nCurrX_136, M2Share.UserEngine.m_nCurrY_136, sMonName);
                    }
                    else
                    {
                        nRandX = HUtil32.Random(nRange * 2 + 1) + (nX - nRange);
                        nRandY = HUtil32.Random(nRange * 2 + 1) + (nY - nRange);
                        mon = M2Share.UserEngine.RegenMonsterByName(M2Share.g_sMissionMap, nRandX, nRandY, sMonName);
                    }
                    if (mon != null)
                    {
                        mon.m_boIsNGMonster = boIsNGMon;
                        if (!boMode)
                        {
                            mon.m_boMission = true;
                            mon.m_nMissionX = M2Share.g_nMissionX;
                            mon.m_nMissionY = M2Share.g_nMissionY;
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_MOBPLACE);
                        break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMobPlace");
            }
        }

        public int ActionOfSetRankLevelName_SubStrConut(string mStr, string mSub)
        {
            int result;
            // 判断'<$Str('字符出现字符串中的次数
            result = (mStr.Length - mStr.Replace(mSub, "").Length) / mSub.Length;
            return result;
        }

        private void ActionOfSetRankLevelName(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TDynamicVar DynamicVar;
            IList<TDynamicVar> DynamicVarList;
            string sName = string.Empty;
            bool boVarFound;
            string sRankLevelName;
            string sTemp;
            string sTemp1 = string.Empty;
            int n10;
            const string sVarFound = "变量%s不存在，变量类型:%s";
            const string sVarTypeError = "变量类型错误，错误类型:%s 当前支持类型(HUMAN、GUILD、GLOBAL)";
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sRankLevelName = QuestActionInfo.sParam1;
                if (sRankLevelName == "")
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SETRANKLEVELNAME);
                    return;
                }
                if (QuestActionInfo.sParam2 != "")
                {
                    boVarFound = false;
                    DynamicVarList = GetDynamicVarList(PlayObject, sRankLevelName, ref sName);
                    if (DynamicVarList == null)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarTypeError, new string[] { sRankLevelName }), QuestActionInfo, M2Share.sSC_SETRANKLEVELNAME);
                        return;
                    }
                    if (DynamicVarList.Count > 0)
                    {
                        for (int i = 0; i < DynamicVarList.Count; i++)
                        {
                            DynamicVar = DynamicVarList[i];
                            if ((DynamicVar.sName).ToLower().CompareTo((QuestActionInfo.sParam2).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        sRankLevelName = (DynamicVar.nInternet).ToString();
                                        break;
                                    case TVarType.vString:
                                        sRankLevelName = DynamicVar.sString;
                                        break;
                                }
                                boVarFound = true;
                                break;
                            }
                        }
                    }
                    if (!boVarFound)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { QuestActionInfo.sParam2, QuestActionInfo.sParam1 }), QuestActionInfo, M2Share.sSC_SETRANKLEVELNAME);
                        return;
                    }
                }
                else
                {
                    int i = ActionOfSetRankLevelName_SubStrConut(sRankLevelName, "<$STR(");
                    if (i > 0)
                    {
                        sTemp = sRankLevelName;
                        sRankLevelName = "";
                        for (int K = 0; K < i; K++)
                        {
                            sTemp = HUtil32.ArrestStringEx(sTemp, "(", ")", ref sTemp1);
                            n10 = M2Share.GetValNameNo(sTemp1);
                            if (n10 >= 0)
                            {
                                switch (n10)
                                {
                                    // Modify the A .. B: 600 .. 699
                                    case 600:
                                        if (PlayObject.m_sString[n10 - 600] != "")
                                        {
                                            if (sRankLevelName != "")
                                            {
                                                sRankLevelName = sRankLevelName + "\\";
                                            }
                                            sRankLevelName = sRankLevelName + PlayObject.m_sString[n10 - 600];
                                        }
                                        break;
                                    // Modify the A .. B: 700 .. 799
                                    case 700:
                                        if (M2Share.g_Config.GlobalAVal[n10 - 700] != "")
                                        {
                                            if (sRankLevelName != "")
                                            {
                                                sRankLevelName = sRankLevelName + "\\";
                                            }
                                            sRankLevelName = sRankLevelName + M2Share.g_Config.GlobalAVal[n10 - 700];
                                        }
                                        break;
                                    // Modify the A .. B: 1200 .. 1599
                                    case 1200:
                                        // 20080903 A变量(100-499)
                                        if (M2Share.g_Config.GlobalAVal[n10 - 1100] != "")
                                        {
                                            if (sRankLevelName != "")
                                            {
                                                sRankLevelName = sRankLevelName + "\\";
                                            }
                                            sRankLevelName = sRankLevelName + M2Share.g_Config.GlobalAVal[n10 - 1100];
                                        }
                                        break;
                                }
                            }
                        }
                    }
                    else
                    {
                        n10 = M2Share.GetValNameNo(sRankLevelName);
                        if (n10 >= 0)
                        {
                            switch (n10)
                            {
                                // Modify the A .. B: 600 .. 699
                                case 600:
                                    sRankLevelName = PlayObject.m_sString[n10 - 600];
                                    break;
                                // Modify the A .. B: 700 .. 799
                                case 700:
                                    sRankLevelName = M2Share.g_Config.GlobalAVal[n10 - 700];
                                    break;
                                // Modify the A .. B: 1200 .. 1599
                                case 1200:
                                    //A变量(100-499)
                                    sRankLevelName = M2Share.g_Config.GlobalAVal[n10 - 1100];
                                    break;
                            }
                        }
                    }
                }
                if (sRankLevelName == "")
                {
                    sRankLevelName = GameMsgDef.g_sRankLevelName;
                }
                else if (sRankLevelName.IndexOf("%s") <= 0)
                {
                    sRankLevelName = "%s\\" + sRankLevelName;
                }
                PlayObject.m_sRankLevelName = sRankLevelName;
                PlayObject.RefShowName();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSetRankLevelName");
            }
        }

        private void ActionOfSetScriptFlag(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            bool boFlag;
            int nWhere;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nWhere = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                boFlag = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1) == 1;
                switch (nWhere)
                {
                    case 0:
                        PlayObject.m_boSendMsgFlag = boFlag;
                        break;
                    case 1:
                        PlayObject.m_boChangeItemNameFlag = boFlag;
                        break;
                    default:
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SETSCRIPTFLAG);
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSetScriptFlag");
            }
        }

        /// <summary>
        /// 功能：调整技能等级
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfSkillLevel(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TMagic Magic;
            TUserMagic UserMagic;
            int nLevel;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nLevel = HUtil32.Str_ToInt(QuestActionInfo.sParam3, 0);
                if (nLevel < 0)
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SKILLLEVEL);
                    return;
                }
                cMethod = QuestActionInfo.sParam2[1];
                Magic = M2Share.UserEngine.FindMagic(QuestActionInfo.sParam1);
                if (Magic != null)
                {
                    if (PlayObject.m_MagicList.Count > 0)
                    {
                        for (int i = 0; i < PlayObject.m_MagicList.Count; i++)
                        {
                            UserMagic = PlayObject.m_MagicList[i];
                            if (UserMagic.MagicInfo == Magic)
                            {
                                switch (cMethod)
                                {
                                    case '=':
                                        if (nLevel >= 0)
                                        {
                                            nLevel = HUtil32._MAX(3, nLevel);
                                            UserMagic.btLevel = (byte)nLevel;
                                        }
                                        break;
                                    case '-':
                                        if (UserMagic.btLevel >= nLevel)
                                        {
                                            UserMagic.btLevel -= (byte)nLevel;
                                        }
                                        else
                                        {
                                            UserMagic.btLevel = 0;
                                        }
                                        break;
                                    case '+':
                                        if (UserMagic.btLevel + nLevel <= 3)
                                        {
                                            UserMagic.btLevel += (byte)nLevel;
                                        }
                                        else
                                        {
                                            UserMagic.btLevel = 3;
                                        }
                                        break;
                                }
                                PlayObject.SendDelayMsg(PlayObject, Grobal2.RM_MAGIC_LVEXP, 0, UserMagic.MagicInfo.wMagicId, UserMagic.btLevel, UserMagic.nTranPoint, "", 100);
                                break;
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSkillLevel");
            }
        }

        /// <summary>
        /// 功能：调整英雄技能等级
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfHeroSkillLevel(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TMagic Magic;
            TUserMagic UserMagic;
            int nLevel;
            char cMethod;
            bool isMagic4;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                isMagic4 = false;
                nLevel = HUtil32.Str_ToInt(QuestActionInfo.sParam3, 0);
                if (nLevel < 0)
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_HEROSKILLLEVEL);
                    return;
                }
                cMethod = QuestActionInfo.sParam2[1];
                if (PlayObject.m_MyHero != null)
                {
                    Magic = M2Share.UserEngine.FindHeroMagic(QuestActionInfo.sParam1);
                    if (Magic != null)
                    {
                        if (new ArrayList(new int[] { 13, 26, 45 }).Contains(Magic.wMagicId))
                        {
                            isMagic4 = true;
                        }
                        if (PlayObject.m_MyHero.m_MagicList.Count > 0)
                        {
                            for (int i = 0; i < PlayObject.m_MyHero.m_MagicList.Count; i++)
                            {
                                UserMagic = PlayObject.m_MyHero.m_MagicList[i];
                                if (UserMagic.MagicInfo == Magic)
                                {
                                    switch (cMethod)
                                    {
                                        case '=':
                                            if (nLevel >= 0)
                                            {
                                                if (isMagic4)
                                                {
                                                    nLevel = HUtil32._MAX(4, nLevel);
                                                }
                                                else
                                                {
                                                    nLevel = HUtil32._MAX(3, nLevel);
                                                }
                                                UserMagic.btLevel = (byte)nLevel;
                                            }
                                            break;
                                        case '-':
                                            if (UserMagic.btLevel >= nLevel)
                                            {
                                                UserMagic.btLevel -= (byte)nLevel;
                                            }
                                            else
                                            {
                                                UserMagic.btLevel = 0;
                                            }
                                            break;
                                        case '+':
                                            if (isMagic4)
                                            {
                                                if (UserMagic.btLevel + nLevel <= 4)
                                                {
                                                    UserMagic.btLevel += (byte)nLevel;
                                                }
                                                else
                                                {
                                                    UserMagic.btLevel = 4;
                                                }
                                            }
                                            else
                                            {
                                                if (UserMagic.btLevel + nLevel <= 3)
                                                {
                                                    UserMagic.btLevel += (byte)nLevel;
                                                }
                                                else
                                                {
                                                    UserMagic.btLevel = 3;
                                                }
                                            }
                                            break;
                                    }
                                    PlayObject.SendDelayMsg(PlayObject, Grobal2.RM_HEROMAGIC_LVEXP, 0, UserMagic.MagicInfo.wMagicId, UserMagic.btLevel, UserMagic.nTranPoint, "", 100);
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    PlayObject.SysMsg("英雄不在线!", TMsgColor.c_Red, TMsgType.t_Hint); // 英雄不在线
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfHeroSkillLevel");
            }
        }

        private void ActionOfTakeCastleGold(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGold;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nGold = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                if (nGold < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nGold);
                }
                if ((nGold < 0) || (this.m_Castle == null))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_TAKECASTLEGOLD);
                    return;
                }
                if (nGold <= this.m_Castle.m_nTotalGold)
                {
                    this.m_Castle.m_nTotalGold -= nGold;
                }
                else
                {
                    this.m_Castle.m_nTotalGold = 0;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfTakeCastleGol");
            }
        }

        // 离线挂机
        private void ActionOfNotLineAddPiont(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            uint dwAutoGetExpTime = 0;
            int nAutoGetExpPoint;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (!PlayObject.m_boNotOnlineAddExp)
                {
                    dwAutoGetExpTime = (uint)HUtil32.Str_ToInt(QuestActionInfo.sParam1, 0);
                    nAutoGetExpPoint = HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0);
                    if (dwAutoGetExpTime * 60 > uint.MaxValue)
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sOFFLINEPLAY);
                        return;
                    }
                    PlayObject.m_dwNotOnlineAddExpTime = dwAutoGetExpTime * 60;
                    PlayObject.m_nNotOnlineAddExpPoint = nAutoGetExpPoint;
                    PlayObject.m_boNotOnlineAddExp = true;// 是离线挂机
                    PlayObject.m_boStartAutoAddExpPoint = true;// 是否自动增加经验
                    PlayObject.m_dwAutoAddExpPointTimeTick = HUtil32.GetTickCount();
                    PlayObject.m_dwAutoAddExpPointTick = HUtil32.GetTickCount();
                    PlayObject.m_boKickAutoAddExpUser = false;
                    PlayObject.m_boAllowDeal = false;// 禁止交易
                    PlayObject.m_boAllowGuild = false;// 禁止加入行会
                    PlayObject.m_boAllowGroup = false;// 禁止组队
                    PlayObject.m_boCanMasterRecall = false;// 禁止师徒传送
                    PlayObject.m_boCanDearRecall = false;// 禁止夫妻传送
                    PlayObject.m_boAllowGuildReCall = false;// 禁止行会合一
                    PlayObject.m_boAllowGroupReCall = false;// 禁止天地合一
                    PlayObject.m_boOpenBox = false;// 宝箱初始化
                    PlayObject.ClearViewRange();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfNotLineAddPiont");
            }
        }

        private void ActionOfKickNotLineAddPiont(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.m_boNotOnlineAddExp)
                {
                    PlayObject.m_boPlayOffLine = false;
                    PlayObject.m_boReconnection = false;
                    PlayObject.m_boSoftClose = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfKickNotLineAddPiont");
            }
        }

        private void ActionOfUnMarry(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TPlayObject PoseHuman;
            TStringList LoadList;
            string sUnMarryFileName;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.m_sDearName == "")
                {
                    GotoLable(PlayObject, "@ExeMarryFail", false);
                    return;
                }
                PoseHuman = ((TPlayObject)(PlayObject.GetPoseCreate()));
                if (PoseHuman == null)
                {
                    GotoLable(PlayObject, "@UnMarryCheckDir", false);
                }
                if (PoseHuman != null)
                {
                    if (QuestActionInfo.sParam1 == "")
                    {
                        if (PoseHuman.m_btRaceServer != Grobal2.RC_PLAYOBJECT)
                        {
                            GotoLable(PlayObject, "@UnMarryTypeErr", false);
                            return;
                        }
                        if (PoseHuman.GetPoseCreate() == PlayObject)
                        {
                            if ((PlayObject.m_sDearName == PoseHuman.m_sCharName))
                            {
                                GotoLable(PlayObject, "@StartUnMarry", false);
                                GotoLable(PoseHuman, "@StartUnMarry", false);
                                return;
                            }
                        }
                    }
                }
                if (((QuestActionInfo.sParam1).ToLower().CompareTo(("REQUESTUNMARRY").ToLower()) == 0))
                {
                    if ((QuestActionInfo.sParam2 == ""))
                    {
                        if (PoseHuman != null)
                        {
                            PlayObject.m_boStartUnMarry = true;
                            if (PlayObject.m_boStartUnMarry && PoseHuman.m_boStartUnMarry)
                            {
                                M2Share.UserEngine.SendBroadCastMsg("[" + this.m_sCharName + "]: " + "我宣布" + PoseHuman.m_sCharName + " " + "与" + PlayObject.m_sCharName + " "
                                    + " " + "正式脱离夫妻关系。", TMsgType.t_Say);
                                PlayObject.m_sDearName = "";
                                PoseHuman.m_sDearName = "";
                                PlayObject.m_btMarryCount++;
                                PoseHuman.m_btMarryCount++;
                                PlayObject.m_boStartUnMarry = false;
                                PoseHuman.m_boStartUnMarry = false;
                                PlayObject.RefShowName();
                                PoseHuman.RefShowName();
                                GotoLable(PlayObject, "@UnMarryEnd", false);
                                GotoLable(PoseHuman, "@UnMarryEnd", false);
                            }
                            else
                            {
                                GotoLable(PlayObject, "@WateUnMarry", false);
                                // GotoLable(PoseHuman,'@RevUnMarry',False);
                            }
                        }
                        return;
                    }
                    else
                    {
                        // 强行离婚
                        if (((QuestActionInfo.sParam2).ToLower().CompareTo(("FORCE").ToLower()) == 0))
                        {
                            M2Share.UserEngine.SendBroadCastMsg("[" + this.m_sCharName + "]: " + "我宣布" + PlayObject.m_sCharName + " " + "与" + PlayObject.m_sDearName + " "
                                + " " + "已经正式脱离夫妻关系！！！", TMsgType.t_Say);
                            PoseHuman = M2Share.UserEngine.GetPlayObject(PlayObject.m_sDearName);
                            if (PoseHuman != null)
                            {
                                PoseHuman.m_sDearName = "";
                                PoseHuman.m_btMarryCount++;
                                PoseHuman.RefShowName();
                            }
                            else
                            {
                                sUnMarryFileName = M2Share.g_Config.sEnvirDir + "UnMarry.txt";
                                LoadList = new TStringList();
                                if (File.Exists(sUnMarryFileName))
                                {
                                    LoadList.LoadFromFile(sUnMarryFileName);
                                }
                                LoadList.Add(PlayObject.m_sDearName);
                                LoadList.SaveToFile(sUnMarryFileName);
                                Dispose(LoadList);
                            }
                            PlayObject.m_sDearName = "";
                            PlayObject.m_btMarryCount++;
                            GotoLable(PlayObject, "@UnMarryEnd", false);
                            PlayObject.RefShowName();
                        }
                        return;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfUnMarry");
            }
        }

        private void ActionOfStartTakeGold(TPlayObject PlayObject)
        {
            TPlayObject PoseHuman;
            try
            {
                PoseHuman = ((TPlayObject)(PlayObject.GetPoseCreate()));
                if ((PoseHuman != null) && (PoseHuman.GetPoseCreate() == PlayObject) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    PlayObject.m_nDealGoldPose = 1;
                    GotoLable(PlayObject, "@startdealgold", false);
                }
                else
                {
                    GotoLable(PlayObject, "@dealgoldpost", false);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfStartTakeGold");
            }
        }


        private void ActionOfAnsiReplaceText(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sValue1;
            string sValue2;
            string sValue3;
            int n01;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sValue1 = QuestActionInfo.sParam1;
                sValue2 = QuestActionInfo.sParam2;
                sValue3 = QuestActionInfo.sParam3;
                if ((sValue1 == "") || (sValue2 == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ANSIREPLACETEXT);
                    return;
                }
                ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref sValue2);
                ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref sValue3);
                n01 = M2Share.GetValNameNo(sValue1);
                if (n01 >= 0)
                {
                    if (HUtil32.rangeInDefined(n01, 600, 699))
                    {
                        sValue1 = PlayObject.m_sString[n01 - 600];
                        if ((sValue1.IndexOf(sValue2) != -1))
                        {
                            PlayObject.m_sString[n01 - 600] = sValue1.Replace(sValue2, sValue3);
                        }
                    }
                    else if (HUtil32.rangeInDefined(n01, 700, 799))
                    {
                        sValue1 = M2Share.g_Config.GlobalAVal[n01 - 700];
                        if ((sValue1.IndexOf(sValue2) != -1))
                        {
                            M2Share.g_Config.GlobalAVal[n01 - 700] = sValue1.Replace(sValue2, sValue3);
                        }
                    }
                    else if (HUtil32.rangeInDefined(n01, 1200, 1599))
                    {
                        sValue1 = M2Share.g_Config.GlobalAVal[n01 - 1100]; // A变量(100-499)
                        if ((sValue1.IndexOf(sValue2) != -1))
                        {
                            M2Share.g_Config.GlobalAVal[n01 - 1100] = sValue1.Replace(sValue2, sValue3);
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ANSIREPLACETEXT);
                    }
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ANSIREPLACETEXT);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfAnsiReplaceText");
            }
        }

        public bool ActionOfEncodeText_GetHumanInfoValue(TPlayObject PlayObject, string sVariable, ref string sValue)
        {
            bool result = false;
            string sMsg;
            string s10 = string.Empty;
            result = false;
            if (sVariable == "")
            {
                return result;
            }
            sMsg = sVariable;
            HUtil32.ArrestStringEx(sMsg, "<", ">", ref s10);
            if (s10 == "")
            {
                return result;
            }
            sVariable = s10;
            if (sVariable == "$USERNAME")// 个人信息
            {
                sValue = PlayObject.m_sCharName;
                result = true;
                return result;
            }
            if (sVariable == "$USERALLNAME") // 全名 
            {
                sValue = PlayObject.GetShowName();
                result = true;
                return result;
            }
            if (sVariable == "$SFNAME")// 师傅名 
            {
                sValue = PlayObject.m_sMasterName;
                result = true;
                return result;
            }
            if (sVariable == "$HERONAME") // 英雄名
            {
                if (PlayObject.m_MyHero != null)
                {
                    sValue = ((THeroObject)(PlayObject.m_MyHero)).m_sCharName;
                    result = true;
                    return result;
                }
            }
            if (sVariable == "$KILLER")// 杀人者变量
            {
                if (PlayObject.m_boDeath && (PlayObject.m_LastHiter != null))
                {
                    if ((PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                    {
                        sValue = PlayObject.m_LastHiter.m_sCharName;
                    }
                    else if ((PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                    {
                        if (PlayObject.m_LastHiter.m_Master != null)
                        {
                            sValue = PlayObject.m_LastHiter.m_Master.m_sCharName;
                        }
                        else
                        {
                            sValue = "未知";
                        }
                    }
                }
                else
                {
                    sValue = "未知";
                }
                result = true;
                return result;
            }
            if (sVariable == "$MONKILLER") // 杀人的怪物变量
            {
                if (PlayObject.m_boDeath && (PlayObject.m_LastHiter != null))
                {
                    if ((PlayObject.m_LastHiter.m_btRaceServer != Grobal2.RC_PLAYOBJECT) && (PlayObject.m_LastHiter.m_btRaceServer != Grobal2.RC_HEROOBJECT))
                    {
                        sValue = PlayObject.m_LastHiter.m_sCharName;
                    }
                }
                else
                {
                    sValue = "未知";
                }
                result = true;
                return result;
            }
            if (sVariable == "$MAP")
            {
                sValue = PlayObject.m_PEnvir.sMapName;
                result = true;
                return result;
            }
            if (sVariable == "$GUILDNAME") // 行会名称
            {
                if (PlayObject.m_MyGuild != null)
                {
                    sValue = PlayObject.m_MyGuild.sGuildName;
                }
                else
                {
                    sValue = "";
                }
                result = true;
                return result;
            }
            if (sVariable == "$RANKNAME")
            {
                sValue = PlayObject.m_sGuildRankName;
                result = true;
                return result;
            }
            if (sVariable == "$DRESS")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_DRESS].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$WEAPON")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_WEAPON].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$RIGHTHAND")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RIGHTHAND].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$HELMET")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_HELMET].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$NECKLACE")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_NECKLACE].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$RING_R")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RINGR].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$RING_L")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RINGL].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$ARMRING_R")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ARMRINGR].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$ARMRING_L")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ARMRINGL].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$BUJUK")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BUJUK].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$BELT")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BELT].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$BOOTS")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BOOTS].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$CHARM")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_CHARM].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$ZHULI")// 斗笠
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ZHULI].wIndex);
                result = true;
                return result;
            }
            else if (sVariable == "$IPADDR")
            {
                sValue = PlayObject.m_sIPaddr;
                result = true;
                return result;
            }
            else if (sVariable == "$IPLOCAL")
            {
                sValue = PlayObject.m_sIPLocal;
                // GetIPLocal(PlayObject.m_sIPaddr);
                result = true;
                return result;
            }
            return result;
        }

        public void ActionOfEncodeText_SetEncodeText(TPlayObject PlayObject, string sValName, string sValue, int n01, TQuestActionInfo QuestActionInfo)
        {
            n01 = M2Share.GetValNameNo(sValName);
            if (n01 >= 0)
            {
                if (HUtil32.rangeInDefined(n01, 600, 699))
                {
                    PlayObject.m_sString[n01 - 600] = sValue;
                }
                else if (HUtil32.rangeInDefined(n01, 700, 799))
                {
                    M2Share.g_Config.GlobalAVal[n01 - 700] = sValue;
                }
                else if (HUtil32.rangeInDefined(n01, 1200, 1599))
                {
                    M2Share.g_Config.GlobalAVal[n01 - 1100] = sValue; // A变量(100-499)
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ENCODETEXT);
                }
            }
            else
            {
                ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_ENCODETEXT);
            }
        }

        private void ActionOfEncodeText(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sNewValue = string.Empty;
            string sValue1 = string.Empty;
            string sValue2 = string.Empty;
            string sValue3 = string.Empty;
            string sValue4 = string.Empty;
            string sValue5 = string.Empty;
            string sValue6 = string.Empty;
            int n01 = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sValue1 = QuestActionInfo.sParam1;
                sValue2 = QuestActionInfo.sParam2;
                sValue3 = QuestActionInfo.sParam3;
                sValue4 = QuestActionInfo.sParam4;
                sValue5 = QuestActionInfo.sParam5;
                sValue6 = QuestActionInfo.sParam6;
                if ((sValue2 != "") && (sValue2[1] == '<') && (sValue2[sValue2.Length] == '>'))
                {
                    ActionOfEncodeText_GetHumanInfoValue(PlayObject, sValue2, ref sValue2);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sValue2, ref sValue2);
                }
                if ((sValue3 != "") && (sValue3[1] == '<') && (sValue3[sValue3.Length] == '>'))
                {
                    ActionOfEncodeText_GetHumanInfoValue(PlayObject, sValue3, ref sValue3);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sValue3, ref sValue3);
                }
                if ((sValue4 != "") && (sValue4[1] == '<') && (sValue4[sValue4.Length] == '>'))
                {
                    ActionOfEncodeText_GetHumanInfoValue(PlayObject, sValue4, ref sValue4);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sValue4, ref sValue4);
                }
                if ((sValue5 != "") && (sValue5[1] == '<') && (sValue5[sValue5.Length] == '>'))
                {
                    ActionOfEncodeText_GetHumanInfoValue(PlayObject, sValue5, ref sValue5);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sValue5, ref sValue5);
                }
                if ((sValue6 != "") && (sValue6[1] == '<') && (sValue6[sValue6.Length] == '>'))
                {
                    ActionOfEncodeText_GetHumanInfoValue(PlayObject, sValue6, ref sValue6);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sValue6, ref sValue6);
                }
                sNewValue = sValue2 + sValue3 + sValue4 + sValue5 + sValue6;
                ActionOfEncodeText_SetEncodeText(PlayObject, sValue1, sNewValue, n01, QuestActionInfo);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfEncodeText");
            }
        }

        /// <summary>
        /// 功能:穿上物品
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfTakeOnItem(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nItemIdx;
            TUserItem UserItem;
            TStdItem StdItem;
            string sItemName;
            string sUserItemName;
            int nWhere;
            bool boFound;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sItemName = QuestActionInfo.sParam1;
                nWhere = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                if ((sItemName == "") || (!(nWhere >= m_UseItems.GetLowerBound(0) && nWhere <= m_UseItems.GetUpperBound(0))))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_TAKEONITEM);
                    return;
                }
                nItemIdx = -1;
                boFound = false;
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        if (PlayObject.m_MyHero.m_ItemList.Count > 0)
                        {
                            for (int i = 0; i < PlayObject.m_MyHero.m_ItemList.Count; i++)
                            {
                                UserItem = (TUserItem)PlayObject.m_MyHero.m_ItemList[i];
                                if (UserItem != null)
                                {
                                    sUserItemName = "";  // 取自定义物品名称
                                    if (UserItem.btValue[13] == 1)
                                    {
                                        sUserItemName = M2Share.ItemUnit.GetCustomItemName(UserItem.MakeIndex, UserItem.wIndex);
                                    }
                                    if (sUserItemName == "")
                                    {
                                        sUserItemName = M2Share.UserEngine.GetStdItemName(UserItem.wIndex);
                                    }
                                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                    if (StdItem != null)
                                    {
                                        if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                                        {
                                            boFound = true;
                                            nItemIdx = UserItem.MakeIndex;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        if ((nItemIdx >= 0) && boFound)
                        {
                            PlayObject.ClientHeroTakeOnItems((byte)nWhere, nItemIdx, sItemName);
                            ((THeroObject)(PlayObject.m_MyHero)).SendUseitems();// 发送使用的物品
                            ((THeroObject)(PlayObject.m_MyHero)).ClientQueryBagItems();
                        }
                    }
                }
                else
                {
                    if (PlayObject.m_ItemList.Count > 0)
                    {
                        for (int i = 0; i < PlayObject.m_ItemList.Count; i++)
                        {
                            UserItem = (TUserItem)PlayObject.m_ItemList[i];
                            if (UserItem != null)
                            {
                                sUserItemName = "";// 取自定义物品名称
                                if (UserItem.btValue[13] == 1)
                                {
                                    sUserItemName = M2Share.ItemUnit.GetCustomItemName(UserItem.MakeIndex, UserItem.wIndex);
                                }
                                if (sUserItemName == "")
                                {
                                    sUserItemName = M2Share.UserEngine.GetStdItemName(UserItem.wIndex);
                                }
                                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                if (StdItem != null)
                                {
                                    if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                                    {
                                        boFound = true;
                                        nItemIdx = UserItem.MakeIndex;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if ((nItemIdx >= 0) && boFound)
                    {
                        PlayObject.ClientTakeOnItems((byte)nWhere, nItemIdx, sItemName);
                        PlayObject.SendUseitems();// 发送使用的物品
                        PlayObject.ClientQueryBagItems();
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfTakeOnItem");
            }
        }

        /// <summary>
        /// 功能:脱下装备
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfTakeOffItem(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nItemIdx;
            string sItemName;
            string sUserItemName;
            int nWhere;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sItemName = QuestActionInfo.sParam1;
                nWhere = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                if ((sItemName == "") || (!(nWhere >= m_UseItems.GetLowerBound(0) && nWhere <= m_UseItems.GetUpperBound(0))))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_TAKEONITEM);
                    return;
                }
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        if (PlayObject.m_MyHero.m_UseItems[nWhere].wIndex > 0)
                        {
                            sUserItemName = "";
                            if (PlayObject.m_MyHero.m_UseItems[nWhere].btValue[13] == 1)
                            {
                                sUserItemName = M2Share.ItemUnit.GetCustomItemName(PlayObject.m_MyHero.m_UseItems[nWhere].MakeIndex, PlayObject.m_MyHero.m_UseItems[nWhere].wIndex);
                            }
                            if (sUserItemName == "")
                            {
                                sUserItemName = M2Share.UserEngine.GetStdItemName(PlayObject.m_MyHero.m_UseItems[nWhere].wIndex);
                            }
                            if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                            {
                                nItemIdx = PlayObject.m_MyHero.m_UseItems[nWhere].MakeIndex;
                                PlayObject.ClientHeroTakeOffItems((byte)nWhere, nItemIdx, sItemName);
                                ((THeroObject)(PlayObject.m_MyHero)).SendUseitems(); // 发送使用的物品
                            }
                        }
                    }
                }
                else
                {
                    if (PlayObject.m_UseItems[nWhere].wIndex > 0)
                    {
                        sUserItemName = "";
                        if (PlayObject.m_MyHero.m_UseItems[nWhere].btValue[13] == 1)
                        {
                            sUserItemName = M2Share.ItemUnit.GetCustomItemName(PlayObject.m_UseItems[nWhere].MakeIndex, PlayObject.m_UseItems[nWhere].wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[nWhere].wIndex);
                        }
                        if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                        {
                            nItemIdx = PlayObject.m_UseItems[nWhere].MakeIndex;
                            PlayObject.ClientTakeOffItems((byte)nWhere, nItemIdx, sItemName);
                            PlayObject.SendUseitems();// 发送使用的物品
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfTakeOffItem");
            }
        }

        /// <summary>
        /// 功能:创建英雄数据
        /// 格式:CREATEHERO 2 1 TRUE 使用方法跟原来的一样，只是后面加个参数TRUE，代表为创建第二个英雄
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfCreateHero(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nJob;
            int nSex;
            int nHair = 0;
            string sMsg;
            string sAccount;
            string sChrName;
            string sHair;
            string sJob;
            string sSex;
            string sLevel;
            string sHeroType;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nJob = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);// 职业
                nSex = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);// 性别
                if ((nJob < 0) || (nSex < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CREATEHERO);
                    return;
                }
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("TRUE").ToLower()) == 0) // 创建卧龙英雄
                {
                    if ((PlayObject.m_sTempHeroCharName.Trim() != "") && (!PlayObject.m_boHasHeroTwo))
                    {
                        switch (nSex)
                        {
                            case 0:
                                nHair = 2;
                                break;
                            case 1:
                                switch (HUtil32.Random(2))
                                {
                                    case 0:
                                        nHair = 1;
                                        break;
                                    case 1:
                                        nHair = 3;
                                        break;
                                }
                                break;
                        }
                        sAccount = PlayObject.m_sUserID;
                        PlayObject.m_sHeroCharName = PlayObject.m_sTempHeroCharName.Trim();
                        sChrName = PlayObject.m_sHeroCharName;
                        PlayObject.m_sTempHeroCharName = "";
                        sHair = (nHair).ToString();
                        sJob = (nJob).ToString();
                        sSex = (nSex).ToString();
                        sLevel = (M2Share.g_Config.nDrinkHeroStartLevel).ToString();
                        sHeroType = 1.ToString();// 英雄类型
                        PlayObject.n_tempHeroTpye = 1;
                        sMsg = sAccount + "/" + sChrName + "/" + sHair + "/" + sJob + "/" + sSex + "/" + sLevel + "/" + PlayObject.m_sCharName + "/" + sHeroType;// 增加主人的名字
                        M2Share.FrontEngine.AddToLoadHeroRcdList(sChrName, sMsg, PlayObject, 1);
                    }
                    else
                    {
                        GotoLable(PlayObject, "@CreateHeroFailEx", false);
                    }
                }
                else
                {
                    if ((PlayObject.m_sTempHeroCharName.Trim() != "") && (!PlayObject.m_boHasHero))// 白日门英雄
                    {
                        switch (nSex)
                        {
                            case 0:
                                nHair = 2;
                                break;
                            case 1:
                                switch (HUtil32.Random(2))
                                {
                                    case 0:
                                        nHair = 1;
                                        break;
                                    case 1:
                                        nHair = 3;
                                        break;
                                }
                                break;
                        }
                        sAccount = PlayObject.m_sUserID;
                        PlayObject.m_sHeroCharName = PlayObject.m_sTempHeroCharName.Trim();
                        sChrName = PlayObject.m_sHeroCharName;
                        PlayObject.m_sTempHeroCharName = "";
                        sHair = (nHair).ToString();
                        sJob = (nJob).ToString();
                        sSex = (nSex).ToString();
                        sLevel = (M2Share.g_Config.nHeroStartLevel).ToString();
                        sHeroType = 0.ToString();// 英雄类型
                        PlayObject.n_tempHeroTpye = 0;
                        sMsg = sAccount + "/" + sChrName + "/" + sHair + "/" + sJob + "/" + sSex + "/" + sLevel + "/" + PlayObject.m_sCharName + "/" + sHeroType;// 增加主人的名字
                        M2Share.FrontEngine.AddToLoadHeroRcdList(sChrName, sMsg, PlayObject, 1);
                    }
                    else
                    {
                        GotoLable(PlayObject, "@CreateHeroFailEx", false);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCreateHero");
            }
        }

        /// <summary>
        ///  删除英雄 对应的NPC才能删除对应的英雄
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfDeleteHero(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (((this) as TMerchant).m_boBuHero) // 卧龙英雄NPC
                {
                    if ((PlayObject.m_boHasHeroTwo) && (PlayObject.n_myHeroTpye == 1))
                    {
                        if ((PlayObject.m_MyHero != null) && (!PlayObject.m_MyHero.m_boDeath))
                        {
                            GotoLable(PlayObject, "@LogOutHeroFirst", false);
                        }
                        else
                        {
                            M2Share.FrontEngine.AddToLoadHeroRcdList(PlayObject.m_sHeroCharName, "", PlayObject, 2);
                        }
                    }
                    else
                    {
                        GotoLable(PlayObject, "@NotHaveHero", false);
                    }
                }
                else
                {
                    if ((PlayObject.m_boHasHero) && (PlayObject.n_myHeroTpye == 0)) // 白日门英雄NPC
                    {
                        if ((PlayObject.m_MyHero != null) && (!PlayObject.m_MyHero.m_boDeath))
                        {
                            GotoLable(PlayObject, "@LogOutHeroFirst", false);
                        }
                        else
                        {
                            M2Share.FrontEngine.AddToLoadHeroRcdList(PlayObject.m_sHeroCharName, "", PlayObject, 2);
                        }
                    }
                    else
                    {
                        GotoLable(PlayObject, "@NotHaveHero", false);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfDeleteHero");
            }
        }

        /// <summary>
        /// 功能:改变英雄等级
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeHeroLevel(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            bool boChgOK;
            int nLevel = 0;
            int nLv = 0;
            int nOldLevel = 0;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROLEVEL);
                    return;
                }
                if (PlayObject.m_MyHero != null)
                {
                    boChgOK = false;
                    nOldLevel = PlayObject.m_MyHero.m_Abil.Level;
                    nLevel = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                    if ((nLevel < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nLevel)))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROLEVEL);
                        return;
                    }
                    cMethod = QuestActionInfo.sParam1[1];
                    switch (cMethod)
                    {
                        case '=':
                            if ((nLevel > 0) && (nLevel <= M2Share.MAXLEVEL))
                            {
                                PlayObject.m_MyHero.m_Abil.Level = (ushort)nLevel;
                                boChgOK = true;
                            }
                            break;
                        case '-':
                            nLv = HUtil32._MAX(0, PlayObject.m_MyHero.m_Abil.Level - nLevel);
                            nLv = HUtil32._MIN(M2Share.MAXLEVEL, nLv);
                            PlayObject.m_MyHero.m_Abil.Level = (ushort)nLv;
                            boChgOK = true;
                            break;
                        case '+':
                            nLv = HUtil32._MAX(0, PlayObject.m_MyHero.m_Abil.Level + nLevel);
                            nLv = HUtil32._MIN(M2Share.MAXLEVEL, nLv);
                            PlayObject.m_MyHero.m_Abil.Level = (ushort)nLv;
                            boChgOK = true;
                            break;
                    }
                    if (boChgOK)
                    {
                        PlayObject.m_MyHero.HasLevelUp(nOldLevel);// 等级调整记录日志
                        M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_MyHero.m_sMapName + "\09" + (PlayObject.m_MyHero.m_nCurrX).ToString()
                            + "\09" + (PlayObject.m_MyHero.m_nCurrY).ToString() + "\09" + PlayObject.m_MyHero.m_sCharName + "\09" + (PlayObject.m_MyHero.m_Abil.Level).ToString()
                            + "\09" + "1" + "\09" + cMethod + "(" + (nLv).ToString() + ")" + "\09" + this.m_sCharName);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeHeroLevel");
            }
        }

        /// <summary>
        /// 功能:改变英雄职业
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeHeroJob(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nJob;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROJOB);
                    return;
                }
                nJob = -1;
                if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "WARRIOR", 3))
                {
                    nJob = 0;
                }
                if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "WIZARD", 3))
                {
                    nJob = 1;
                }
                if (HUtil32.CompareLStr(QuestActionInfo.sParam1, "TAOIST", 3))
                {
                    nJob = 2;
                }
                if (nJob < 0)
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROJOB);
                    return;
                }
                if (PlayObject.m_MyHero != null)
                {
                    if (PlayObject.m_MyHero.m_btJob != nJob)
                    {
                        PlayObject.m_MyHero.m_btJob = (byte)nJob;
                        PlayObject.m_MyHero.HasLevelUp(0);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeHeroJob");
            }
        }

        /// <summary>
        /// 功能:清除英雄技能
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfClearHeroSkill(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserMagic UserMagic;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CLEARHEROSKILL);
                    return;
                }
                if (PlayObject.m_MyHero != null)
                {
                    if (QuestActionInfo.sParam1 != "")  // 指定技能名称,则删除指定的技能
                    {
                        for (int i = PlayObject.m_MyHero.m_MagicList.Count - 1; i >= 0; i--)
                        {
                            if (PlayObject.m_MyHero.m_MagicList.Count <= 0)
                            {
                                break;
                            }
                            UserMagic = PlayObject.m_MyHero.m_MagicList[i];
                            if (UserMagic != null)
                            {
                                if ((UserMagic.MagicInfo.sMagicName).ToLower().CompareTo((QuestActionInfo.sParam1).ToLower()) == 0)
                                {
                                    ((THeroObject)(PlayObject.m_MyHero)).SendDelMagic(UserMagic);
                                    UserMagic = null;
                                    PlayObject.m_MyHero.m_MagicList.RemoveAt(i);
                                    break;
                                }
                            }
                        }
                    }
                    else // 没有指定技能名称,则删除全部技能
                    {
                        for (int i = PlayObject.m_MyHero.m_MagicList.Count - 1; i >= 0; i--)
                        {
                            if (PlayObject.m_MyHero.m_MagicList.Count <= 0)
                            {
                                break;
                            }
                            UserMagic = PlayObject.m_MyHero.m_MagicList[i];
                            ((THeroObject)(PlayObject.m_MyHero)).SendDelMagic(UserMagic);
                            UserMagic = null;
                            PlayObject.m_MyHero.m_MagicList.RemoveAt(i);
                        }
                    }
                    ((THeroObject)(PlayObject.m_MyHero)).RecalcAbilitys();
                    PlayObject.m_MyHero.CompareSuitItem(false);//套装
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfClearHeroSkill");
            }
        }

        /// <summary>
        /// 功能：改变英雄PK点数
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeHeroPKPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nPKPOINT;
            int nPoint;
            int nOldPKLevel;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROPKPOINT);
                    return;
                }
                if (PlayObject.m_MyHero != null)
                {
                    nOldPKLevel = PlayObject.m_MyHero.PKLevel();
                    nPKPOINT = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                    if ((nPKPOINT < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nPKPOINT)))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROPKPOINT);
                        return;
                    }
                    cMethod = QuestActionInfo.sParam1[0];
                    switch (cMethod)
                    {
                        case '=':
                            if ((nPKPOINT >= 0))
                            {
                                PlayObject.m_MyHero.m_nPkPoint = nPKPOINT;
                            }
                            break;
                        case '-':
                            nPoint = HUtil32._MAX(0, PlayObject.m_MyHero.m_nPkPoint - nPKPOINT);
                            PlayObject.m_MyHero.m_nPkPoint = nPoint;
                            break;
                        case '+':
                            nPoint = HUtil32._MAX(0, PlayObject.m_MyHero.m_nPkPoint + nPKPOINT);
                            PlayObject.m_MyHero.m_nPkPoint = nPoint;
                            break;
                    }
                    if (nOldPKLevel != PlayObject.m_MyHero.PKLevel())
                    {
                        PlayObject.m_MyHero.RefNameColor();
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeHeroPKPoint");
            }
        }

        /// <summary>
        /// 功能:给矿石
        /// 命令格式:GIVEMINE 矿名称 数量 纯度
        /// 如纯度不填,则随机给纯度
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private unsafe void ActionOfGIVEMINE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sMineName;
            int nMineCount;
            int nDura;
            TUserItem UserItem = null;
            TStdItem StdItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sMineName = QuestActionInfo.sParam1;// 矿名
                nMineCount = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);// 数量
                nDura = HUtil32.Str_ToInt(QuestActionInfo.sParam3, -1);// 纯度
                if ((nMineCount <= 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nMineCount)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GIVEMINE);
                    return;
                }
                if (nDura < 0)
                {
                    nDura = HUtil32.Random(18) + 3;
                }
                if ((sMineName == "") || (nMineCount < 0) || (nDura < 0) || (nDura > 100))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GIVEMINE);
                    return;
                }
                if (nMineCount > 0)
                {
                    for (int i = 0; i < nMineCount; i++)
                    {
                        UserItem = new TUserItem();
                        if (M2Share.UserEngine.CopyToUserItemFromName(sMineName, UserItem))
                        {
                            StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                            if ((StdItem != null))
                            {
                                if ((StdItem.StdMode == 43))
                                {
                                    if (this.IsAddWeightAvailable(StdItem.Weight * nMineCount))
                                    {
                                        UserItem.Dura = Convert.ToUInt16(nDura * 1000);
                                        if (UserItem.Dura > UserItem.DuraMax)
                                        {
                                            UserItem.Dura = UserItem.DuraMax;
                                        }
                                        if (StdItem.NeedIdentify == 1) // 记录游戏日志
                                        {
                                            M2Share.AddGameDataLog("39" + "\09" + this.m_sMapName + "\09" + this.m_nCurrX + "\09" + this.m_nCurrY
                                                + "\09" + PlayObject.m_sCharName + "\09" + StdItem.Name + "\09" + UserItem.MakeIndex + "\09"
                                                + UserItem.Dura + "/" + UserItem.DuraMax + "\09" + this.m_sCharName);
                                        }
                                        PlayObject.m_ItemList.Add(UserItem);
                                        PlayObject.SendAddItem(UserItem);
                                    }
                                }
                            }
                        }
                        else
                        {
                            UserItem = null;
                            break;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGIVEMINE");
            }
        }

        /// <summary>
        /// 功能:改变英雄的经验
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeHeroExp(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nExp;
            char cMethod;
            int dwInt;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROEXP);
                    return;
                }
                nExp = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                if ((nExp < 0) && (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nExp)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEHEROEXP);
                    return;
                }
                if (PlayObject.m_MyHero != null)
                {
                    cMethod = QuestActionInfo.sParam1[0];
                    switch (cMethod)
                    {
                        case '=':
                            if (nExp >= 0)
                            {
                                PlayObject.m_MyHero.m_Abil.Exp = nExp;
                                dwInt = nExp;
                            }
                            break;
                        case '-':
                            if (PlayObject.m_MyHero.m_Abil.Exp > nExp)
                            {
                                PlayObject.m_MyHero.m_Abil.Exp -= nExp;
                            }
                            else
                            {
                                PlayObject.m_MyHero.m_Abil.Exp = 0;
                            }
                            break;
                        case '+':
                            if (PlayObject.m_MyHero.m_Abil.Level < M2Share.g_Config.nLimitExpLevel) // 是否超过限制等级 修改
                            {
                                dwInt = nExp;
                            }
                            else
                            {
                                dwInt = M2Share.g_Config.nLimitExpValue;
                            }
                            ((THeroObject)(PlayObject.m_MyHero)).GetExp(dwInt);
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeHeroExp");
            }
        }

        private unsafe void ActionOfRepairItem(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nWhere;
            TStdItem StdItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1) >= 0)
                {
                    nWhere = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                    if ((nWhere >= m_UseItems.GetLowerBound(0) && nWhere <= m_UseItems.GetUpperBound(0)))
                    {
                        if (PlayObject.m_UseItems[nWhere].wIndex > 0)
                        {
                            StdItem = M2Share.UserEngine.GetStdItem(PlayObject.m_UseItems[nWhere].wIndex);
                            if (StdItem != null)
                            {
                                if ((PlayObject.m_UseItems[nWhere].DuraMax > PlayObject.m_UseItems[nWhere].Dura) && (StdItem.StdMode != 43))
                                {
                                    if (this.CheckItemValue(PlayObject.m_UseItems[nWhere], 3))// 禁止修
                                    {
                                        return;
                                    }
                                    else if (PlayObject.PlugOfCheckCanItem(3, StdItem.Name, false, 0, 0)) // 禁止物品规则(管理插件功能)
                                    {
                                        return;
                                    }
                                    PlayObject.m_UseItems[nWhere].Dura = PlayObject.m_UseItems[nWhere].DuraMax;
                                    PlayObject.SendMsg(PlayObject, Grobal2.RM_DURACHANGE, nWhere, PlayObject.m_UseItems[nWhere].Dura, PlayObject.m_UseItems[nWhere].DuraMax, 0, "");
                                }
                            }
                        }
                    }
                    else
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_REPAIRITEM);
                    }
                }
                else if (HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1) < 0)
                {
                    for (nWhere = m_UseItems.GetLowerBound(0); nWhere <= m_UseItems.GetUpperBound(0); nWhere++)
                    {
                        if (PlayObject.m_UseItems[nWhere].wIndex > 0)
                        {
                            StdItem = M2Share.UserEngine.GetStdItem(PlayObject.m_UseItems[nWhere].wIndex);
                            if (StdItem != null)
                            {
                                if ((PlayObject.m_UseItems[nWhere].DuraMax > PlayObject.m_UseItems[nWhere].Dura) && (StdItem.StdMode != 43))
                                {
                                    if (this.CheckItemValue(PlayObject.m_UseItems[nWhere], 3)) // 禁止修
                                    {
                                        continue;
                                    }
                                    else if (PlayObject.PlugOfCheckCanItem(3, StdItem.Name, false, 0, 0)) // 禁止物品规则(管理插件功能)
                                    {
                                        continue;
                                    }
                                    PlayObject.m_UseItems[nWhere].Dura = PlayObject.m_UseItems[nWhere].DuraMax;
                                    PlayObject.SendMsg(PlayObject, Grobal2.RM_DURACHANGE, nWhere, PlayObject.m_UseItems[nWhere].Dura, PlayObject.m_UseItems[nWhere].DuraMax, 0, "");
                                }
                            }
                        }
                    }
                }
                else
                {
                    // ScriptActionError(PlayObject, '', QuestActionInfo, sSC_REPAIRITEM);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfRepairItem");
            }
        }

        private void ActionOfOpenMakeKIMNeedle(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
        }

        private unsafe void ActionOfTAKEKIMNEEDLE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserItem UserItem;
            TStdItem StdItem;
            int nCount;
            string sName = string.Empty;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            PlayObject.m_boCanQueryBag = true;// NPC操作物品时,不能刷新包裹
            try
            {
                sName = QuestActionInfo.sParam1;
                nCount = QuestActionInfo.nParam2;
                if (sName == "")
                {
                    return;
                }
                if (nCount <= 0)
                {
                    return;
                }
                try
                {
                    for (int i = PlayObject.m_ItemList.Count - 1; i >= 0; i--)
                    {
                        if (nCount <= 0)
                        {
                            break;
                        }
                        if (PlayObject.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem)PlayObject.m_ItemList[i];
                        if (UserItem == null)
                        {
                            continue;
                        }
                        if ((M2Share.UserEngine.GetStdItemName(UserItem.wIndex)).ToLower().CompareTo((sName).ToLower()) == 0)
                        {
                            StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                            if (StdItem != null)
                            {
                                if (StdItem.NeedIdentify == 1)
                                {
                                    M2Share.AddGameDataLog("10" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString()
                                        + "\09" + PlayObject.m_sCharName + "\09" + sName + "\09" + (UserItem.MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem.DC)).ToString()
                                        + "/" + (HUtil32.HiWord(StdItem.DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MC)).ToString() + ")"
                                        + "(" + (HUtil32.LoWord(StdItem.SC)).ToString() + "/" + (HUtil32.HiWord(StdItem.SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.AC)).ToString() + "/"
                                        + (HUtil32.HiWord(StdItem.AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MAC)).ToString() + ")"
                                        + (UserItem.btValue[0]).ToString() + "/" + (UserItem.btValue[1]).ToString() + "/" + (UserItem.btValue[2]).ToString() + "/" + (UserItem.btValue[3]).ToString()
                                        + "/" + (UserItem.btValue[4]).ToString() + "/" + (UserItem.btValue[5]).ToString() + "/" + (UserItem.btValue[6]).ToString() + "/" + (UserItem.btValue[7]).ToString()
                                        + "/" + (UserItem.btValue[8]).ToString() + "/" + (UserItem.btValue[14]).ToString() + "\09" + this.m_sCharName);
                                }
                                PlayObject.m_ItemList.RemoveAt(i);
                                PlayObject.SendDelItems(UserItem);
                                Dispose(UserItem);
                                UserItem = null;
                                //HUtil32.DisPoseAndNil(ref UserItem);
                                nCount -= 1;
                            }
                        }
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("[异常] TakeKimItem");
                }
            }
            finally
            {
                PlayObject.m_boCanQueryBag = false; // NPC操作物品时,不能刷新包裹
            }
        }

        private void ActionOfGIVEKIMNEEDLE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
        }

        private void ActionOfOPENPULSE(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if ((QuestActionInfo.nParam1 >= 0 && QuestActionInfo.nParam1 <= 3) && (QuestActionInfo.nParam2 >= 1 && QuestActionInfo.nParam2 <= 5))
                {
                    if ((QuestActionInfo.sParam3).ToLower().CompareTo(("Hero").ToLower()) == 0)
                    {
                        if (PlayObject.m_MyHero != null)
                        {
                            if (((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[QuestActionInfo.nParam1].Pulse == QuestActionInfo.nParam2 - 1)
                            {
                                //((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[QuestActionInfo.nParam1].Pulse = QuestActionInfo.nParam2;
                                ((THeroObject)(PlayObject.m_MyHero)).SendMsg(PlayObject, Grobal2.RM_HEROPULSECHANGED, 1, 0, 0, 0, "");
                                ((THeroObject)(PlayObject.m_MyHero)).SendRefMsg(Grobal2.RM_MYSHOW, 13, 0, 0, 0, "");
                            }
                        }
                    }
                    else
                    {
                        if (PlayObject.m_HumPulses[QuestActionInfo.nParam1].Pulse == QuestActionInfo.nParam2 - 1)
                        {
                            //PlayObject.m_HumPulses[QuestActionInfo.nParam1].Pulse = QuestActionInfo.nParam2;
                            PlayObject.SendMsg(PlayObject, Grobal2.RM_PULSECHANGED, 0, 0, 0, 0, "");
                            PlayObject.SendRefMsg(Grobal2.RM_MYSHOW, 13, 0, 0, 0, "");
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfOPENPULSE");
            }
        }

        private void ActionOfChangePulseLevel(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int i01;
            int i02;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            i01 = QuestActionInfo.nParam1;
            i02 = QuestActionInfo.nParam3;
            if ((QuestActionInfo.sParam4).ToLower().CompareTo(("Hero").ToLower()) == 0)
            {
                if (PlayObject.m_MyHero != null)
                {
                    if ((i01 >= 0) && (i02 >= 0))
                    {
                        if (QuestActionInfo.sParam2 == "+")
                        {
                            if ((((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[i01].PulseLevel + i02) <= 5)
                            {
                                ((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[i01].PulseLevel = Convert.ToByte(((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[i01].PulseLevel + i02);
                            }
                        }
                        else if (QuestActionInfo.sParam2 == "-")
                        {
                            if ((((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[i01].PulseLevel - i02) >= 1)
                            {
                                ((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[i01].PulseLevel = Convert.ToByte(((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[i01].PulseLevel + i02);
                            }
                        }
                        else if (QuestActionInfo.sParam2 == "=")
                        {
                            if (i02 >= 0 && i02 <= 5)
                            {
                                ((THeroObject)(PlayObject.m_MyHero)).m_HumPulses[i01].PulseLevel = (byte)i02;
                            }
                        }
                        // THeroobject(PlayObject.m_MyHero).SendMsg(Self,RM_RUSHPULSE_OK, 0, 0, 0, 1, '');
                        ((THeroObject)(PlayObject.m_MyHero)).SendMsg(this, Grobal2.RM_HEROPULSECHANGED, 0, 0, 0, 1, "");
                    }
                }
            }
            else
            {
                if ((i01 >= 0) && (i02 >= 0))
                {
                    if (QuestActionInfo.sParam2 == "+")
                    {
                        if ((PlayObject.m_HumPulses[i01].PulseLevel + i02) <= 5)
                        {
                            PlayObject.m_HumPulses[i01].PulseLevel = Convert.ToByte(PlayObject.m_HumPulses[i01].PulseLevel + i02);
                        }
                    }
                    else if (QuestActionInfo.sParam2 == "-")
                    {
                        if ((PlayObject.m_HumPulses[i01].PulseLevel - i02) >= 1)
                        {
                            PlayObject.m_HumPulses[i01].PulseLevel = Convert.ToByte(PlayObject.m_HumPulses[i01].PulseLevel + i02);
                        }
                    }
                    else if (QuestActionInfo.sParam2 == "=")
                    {
                        if (i02 >= 0 && i02 <= 5)
                        {
                            PlayObject.m_HumPulses[i01].PulseLevel = (byte)i02;
                        }
                    }
                    PlayObject.SendMsg(this, Grobal2.RM_RUSHPULSE_OK, 0, 0, 0, 0, "");
                    PlayObject.SendMsg(this, Grobal2.RM_PULSECHANGED, 0, 0, 0, 0, "");
                }
            }
        }


        /// <summary>
        /// 改变名字颜色
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeNameColor(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nColor = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nColor))// 增加变量支持
                {
                    nColor = QuestActionInfo.nParam1;
                }
                if ((nColor < 0) || (nColor > 255))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGENAMECOLOR);
                    return;
                }
                PlayObject.m_btNameColor = (byte)nColor;
                PlayObject.RefNameColor();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeNameColor");
            }
        }

        /// <summary>
        /// 清除仓库密码
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfClearPassword(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.m_sStoragePwd = "";
                PlayObject.m_boPasswordLocked = false;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfClearPassword");
            }
        }

        /// <summary>
        /// RECALLMOB 怪物名称 等级 叛变时间 变色(0,1) 固定颜色(1-7) 是否显示主人名字(1--不显示,空或其它值显示)
        /// 变色为0 时固定颜色才起作用
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfRecallmob(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TBaseObject mon;
            int nParam3;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nParam3 = HUtil32.Str_ToInt(QuestActionInfo.sParam3, 0);
                if (nParam3 <= 1)
                {
                    mon = PlayObject.MakeSlave(QuestActionInfo.sParam1, 3, HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0), 100, 864000); // 10 * 24 * 60 * 60
                }
                else
                {
                    mon = PlayObject.MakeSlave(QuestActionInfo.sParam1, 3, HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0), 100, Convert.ToUInt32(nParam3 * 60));
                }
                if (mon != null)
                {
                    if ((QuestActionInfo.sParam4 != "") && (QuestActionInfo.sParam4[1] == '1'))
                    {
                        mon.m_boAutoChangeColor = true;
                    }
                    else if (QuestActionInfo.nParam5 > 0)
                    {
                        mon.m_boFixColor = true;
                        mon.m_nFixColorIdx = QuestActionInfo.nParam5 - 1;
                    }
                    if ((QuestActionInfo.sParam6 != "") && (QuestActionInfo.sParam6[1] == '1'))
                    {
                        mon.m_nCopyHumanLevel = 3; // 不显示主人名字
                    }
                    if (mon.m_btRaceServer == Grobal2.RC_PLAYMOSTER) // 如果是人形怪
                    {
                        mon.m_nCopyHumanLevel = 1;
                        if ((QuestActionInfo.sParam6 != "") && (QuestActionInfo.sParam6[1] == '1'))
                        {
                            mon.m_nCopyHumanLevel = 3;// 不显示主人名字
                        }
                        if (this.m_ItemList.Count > 0)
                        {
                            for (int i = 0; i < this.m_ItemList.Count; i++) // 清除包裹
                            {
                                Dispose(this.m_ItemList[i]);
                            }
                        }
                        this.m_ItemList.Clear();
                        ((TPlayMonster)(mon)).InitializeMonster();// 人形怪重新加载怪物设置
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfRecallmob");
            }
        }

        /// <summary>
        /// RECALLMOBEX 怪物名称 名称颜色 坐标X 坐标Y
        /// 注，使用该命令召出的宝宝，凡是没有主人或者与主人不在同一地图将自动消失
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfRecallMobex(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TBaseObject mon;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                mon = M2Share.UserEngine.RegenMonsterByName(this.m_PEnvir.sMapName, HUtil32.Str_ToInt(QuestActionInfo.sParam3, 0),
                    HUtil32.Str_ToInt(QuestActionInfo.sParam4, 0), QuestActionInfo.sParam1);
                if (mon != null)
                {
                    mon.m_Master = PlayObject;
                    mon.m_dwMasterRoyaltyTick = 86400000; // 24 * 60 * 60 * 1000
                    mon.m_dwMasterRoyaltyTime = HUtil32.GetTickCount();// 怪物叛变计时
                    mon.m_btSlaveMakeLevel = 3;
                    mon.m_btSlaveExpLevel = 1;
                    if (mon.m_btRaceServer == 135)// 135怪,不显示主人名字
                    {
                        mon.m_nCopyHumanLevel = 3;
                        mon.m_btSlaveExpLevel = M2Share.SLAVEMAXLEVEL;// 135怪,不改变名字颜色
                    }
                    mon.m_btNameColor = (byte)HUtil32.Str_ToInt(QuestActionInfo.sParam2, 0);
                    mon.RecalcAbilitys();
                    mon.RefNameColor();
                    PlayObject.m_SlaveList.Add(mon);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfRECALLMOBEX");
            }
        }

        /// <summary>
        /// 命令格式:MOVEMOBTO 怪物名称 原地图 原X 原Y 新地图 新X 新Y 
        /// (将指定坐标的怪物移动到新坐标，名称为ALL则移动该坐标所有怪)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfMoveMobto(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            bool boMoveAll;
            string sMonName;
            string sMap1;
            string sMap2;
            Envirnoment SrcEnvir;
            Envirnoment DenEnvir;
            List<TBaseObject> MonList;
            int nX;
            int nY;
            int OnX;
            int OnY;
            TBaseObject MoveMon;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                boMoveAll = false;
                nX = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam6), -1);// 新X 支持变量
                nY = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam7), -1);// 新Y 支持变量
                OnX = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);// 原X 支持变
                OnY = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam4), -1);// 原Y 支持变
                sMonName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);// 怪物名称 支持变量 
                if (sMonName == "ALL")
                {
                    boMoveAll = true;
                }
                sMap1 = GetLineVariableText(PlayObject, QuestActionInfo.sParam2);// 地图支持变量
                sMap2 = GetLineVariableText(PlayObject, QuestActionInfo.sParam5);// 地图支持变量
                SrcEnvir = M2Share.g_MapManager.FindMap(sMap1);
                DenEnvir = M2Share.g_MapManager.FindMap(sMap2);
                if ((SrcEnvir == null) || (DenEnvir == null))
                {
                    return;
                }
                MonList = new List<TBaseObject>();
                try
                {
                    if (!boMoveAll) // 指定名称的怪移动
                    {
                        M2Share.UserEngine.GetMapRangeMonster(SrcEnvir, OnX, OnY, 1, MonList);// 查指定XY范围内的怪
                        if (MonList.Count > 0)
                        {
                            for (int i = 0; i < MonList.Count; i++)
                            {
                                MoveMon = MonList[i];
                                if (MoveMon != this)
                                {
                                    if (string.Compare(MoveMon.m_sCharName, sMonName, true) == 0) // 是否是指定名称的怪
                                    {
                                        MoveMon.SpaceMove(sMap2, nX, nY, 0);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        // 所有怪移动
                        M2Share.UserEngine.GetMapRangeMonster(SrcEnvir, OnX, OnY, 1000, MonList);// 查指定XY范围内的怪
                        if (MonList.Count > 0)
                        {
                            for (int i = 0; i < MonList.Count; i++)
                            {
                                MoveMon = MonList[i];
                                if (MoveMon != this)
                                {
                                    MoveMon.SpaceMove(sMap2, nX, nY, 0);
                                }
                            }
                        }
                    }
                }
                finally
                {
                    Dispose(MonList);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMOVEMOBTO");
            }
        }

        /// <summary>
        /// ClearItemMap 地图 X Y 范围 物品名称 
        /// (清除地图物品，物品名称为ALL则清除所有)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfClearItemMap(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sItmeName;
            string sMap;
            int nX;
            int nY;
            int nRange;
            int nXX;
            int nYY;
            bool boClearAll;
            Envirnoment Envir;
            TMapItem MapItem;
            List<TMapItem> ItemList;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                boClearAll = false;
                sItmeName = QuestActionInfo.sParam5;// 物品名称
                sMap = QuestActionInfo.sParam1;
                if ((sMap != "") && (sMap[0] == '<') && (sMap[1] == '$')) // 增加支持<$Str()>
                {
                    sMap = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref sMap);
                }
                nX = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);// X
                nY = HUtil32.Str_ToInt(QuestActionInfo.sParam3, -1);// Y
                nRange = HUtil32.Str_ToInt(QuestActionInfo.sParam4, -1);// 范围
                if ((sItmeName == "ALL") || (sItmeName == ""))
                {
                    boClearAll = true;
                }
                Envir = M2Share.g_MapManager.FindMap(sMap);// 查找地图
                if (Envir != null)
                {
                    ItemList = new List<TMapItem>();
                    Envir.GetMapItem(nX, nY, nRange, ItemList);// 取地图上指定范围的物品
                    if (!boClearAll)  // 清除指定物品
                    {
                        if (ItemList.Count > 0)
                        {
                            for (int i = 0; i < ItemList.Count; i++)
                            {
                                MapItem = ItemList[i];
                                if (((MapItem.Name).ToLower().CompareTo((sItmeName).ToLower()) == 0))
                                {
                                    for (nXX = nX - nRange; nXX <= nX + nRange; nXX++)
                                    {
                                        for (nYY = nY - nRange; nYY <= nY + nRange; nYY++)
                                        {
                                            Envir.DeleteFromMap(nXX, nYY, Grobal2.OS_ITEMOBJECT, MapItem);
                                            if (MapItem == null)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        // 清除全部物品
                        if (ItemList.Count > 0)
                        {
                            for (int i = 0; i < ItemList.Count; i++)
                            {
                                MapItem = ItemList[i];
                                for (nXX = nX - nRange; nXX <= nX + nRange; nXX++)
                                {
                                    for (nYY = nY - nRange; nYY <= nY + nRange; nYY++)
                                    {
                                        Envir.DeleteFromMap(nXX, nYY, Grobal2.OS_ITEMOBJECT, MapItem);
                                        if (MapItem == null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    Dispose(ItemList);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCLEARITEMMAP");
            }
        }

        private void ActionOfReNewLevel(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nReLevel;
            int nLevel;
            int nBounsuPoint;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nReLevel = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), -1);
                nLevel = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                nBounsuPoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);
                if (nReLevel < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nReLevel);// 增加变量支持
                }
                if (nLevel < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nLevel);// 增加变量支持
                }
                if (nBounsuPoint < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref nBounsuPoint);// 增加变量支持
                }
                if ((nReLevel < 0) || (nLevel < 0) || (nBounsuPoint < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_RENEWLEVEL);
                    return;
                }
                if ((PlayObject.m_btReLevel + nReLevel) <= 255)
                {
                    PlayObject.m_btReLevel += (byte)nReLevel;
                    if (nLevel > 0)
                    {
                        PlayObject.m_Abil.Level = (ushort)nLevel;
                        // 等级调整记录日志
                        M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09"
                            + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + (PlayObject.m_Abil.Level).ToString()
                            + "\09" + "0" + "\09" + "=(" + (nLevel).ToString() + ")" + "\09" + this.m_sCharName + "(转生)");
                    }
                    if (M2Share.g_Config.boReNewLevelClearExp)
                    {
                        PlayObject.m_Abil.Exp = 0;
                    }
                    PlayObject.m_nBonusPoint += nBounsuPoint;
                    PlayObject.SendMsg(PlayObject, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                    PlayObject.HasLevelUp(0);
                    PlayObject.RefShowName();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfReNewLevel");
            }
        }

        /// <summary>
        /// 功能：改变角色性别
        /// 格式：CHANGEGENDER 性别(0,1) Hero
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeGender(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nGENDER;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nGENDER = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                if (!(new ArrayList(new int[] { 0, 1 }).Contains(nGENDER)))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEGENDER);
                    return;
                }
                if ((QuestActionInfo.sParam2).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEGENDER);
                        return;
                    }
                    if (PlayObject.m_MyHero != null)
                    {
                        PlayObject.m_MyHero.m_btGender = (byte)nGENDER;
                        ((THeroObject)(PlayObject.m_MyHero)).SendMsg(PlayObject.m_MyHero, Grobal2.RM_HEROABILITY, 0, 0, 0, 0, "");// 发送英雄属性
                        PlayObject.m_MyHero.FeatureChanged();
                    }
                }
                else
                {
                    PlayObject.m_btGender = (byte)nGENDER;
                    PlayObject.FeatureChanged();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeGender");
            }
        }

        /// <summary>
        /// 清除属下
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfKillSlave(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TBaseObject Slave;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject.m_SlaveList.Count > 0)
                {
                    for (int i = 0; i < PlayObject.m_SlaveList.Count; i++)
                    {
                        Slave = PlayObject.m_SlaveList[i];
                        Slave.m_WAbil.HP = 0;
                        Slave.MakeGhost();
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfKillSlave");
            }
        }

        /// <summary>
        /// 改变经验倍数
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfKillMonExpRate(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nRate;
            int nTime;
            byte nCode = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (PlayObject != null)
                {
                    nRate = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                    nTime = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                    if ((nRate < 0) || (nTime < 0))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_KILLMONEXPRATE);
                        return;
                    }
                    nCode = 1;
                    PlayObject.m_nKillMonExpRate = nRate;
                    PlayObject.m_nOldKillMonExpRate = PlayObject.m_nKillMonExpRate;
                    PlayObject.m_dwKillMonExpRateTime = (UInt16)nTime;
                    nCode = 2;
                    if (PlayObject.m_MyHero != null)  // 英雄也同时双倍经验 
                    {
                        nCode = 3;
                        ((THeroObject)(PlayObject.m_MyHero)).m_nKillMonExpRate = nRate;
                        ((THeroObject)(PlayObject.m_MyHero)).m_nOldKillMonExpRate = ((THeroObject)(PlayObject.m_MyHero)).m_nKillMonExpRate;// 没使用套装前杀怪经验倍数
                    }
                    nCode = 4;
                    if (M2Share.g_Config.boShowScriptActionMsg)
                    {
                        nCode = 5;
                        PlayObject.SysMsg(string.Format(GameMsgDef.g_sChangeKillMonExpRateMsg, PlayObject.m_nKillMonExpRate / 100, PlayObject.m_dwKillMonExpRateTime), TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfKillMonExpRate Code:" + nCode);
            }
        }

        /// <summary>
        /// 格式:MONGENEX 地图 X Y 怪名|是否内功怪(0/1)|怪物颜色值 范围 数量
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfMonGenEx(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sMapName;
            string sMonName = string.Empty;
            string sNGMon;
            string sNameColor;
            int nMapX = 0;
            int nMapY = 0;
            int nRange = 0;
            int nCount = 0;
            int nRandX = 0;
            int nRandY = 0;
            byte nNameColor = 0;
            TBaseObject Monster;
            string sStr;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sNGMon = "";
                sNameColor = "";
                sMapName = QuestActionInfo.sParam1;
                nMapX = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                nMapY = HUtil32.Str_ToInt(QuestActionInfo.sParam3, -1);
                if (QuestActionInfo.sParam4.IndexOf("|") > 0)
                {
                    sStr = HUtil32.GetValidStr3(QuestActionInfo.sParam4, ref sMonName, new string[] { "|" });
                    sNameColor = HUtil32.GetValidStr3(sStr, ref sNGMon, new string[] { "|" });
                    if ((sNameColor != ""))
                    {
                        nNameColor = (byte)HUtil32.Str_ToInt(sNameColor.Trim(), 255); // 名字颜色
                    }
                }
                else
                {
                    sMonName = QuestActionInfo.sParam4;
                }
                nRange = QuestActionInfo.nParam5;
                nCount = QuestActionInfo.nParam6;
                if ((sMapName == "") || (nMapX <= 0) || (nMapY <= 0) || (sMapName == "") || (nRange <= 0) || (nCount <= 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_MONGENEX);
                    return;
                }
                for (int i = 0; i < nCount; i++)
                {
                    nRandX = HUtil32.Random(nRange * 2 + 1) + (nMapX - nRange);
                    nRandY = HUtil32.Random(nRange * 2 + 1) + (nMapY - nRange);
                    Monster = M2Share.UserEngine.RegenMonsterByName(sMapName, nRandX, nRandY, sMonName);
                    if (Monster == null)
                    {
                        //ScriptActionError(PlayObject,"",QuestActionInfo,sSC_MONGENEX);
                        break;
                    }
                    else
                    {
                        if ((sNGMon != ""))
                        {
                            Monster.m_boIsNGMonster = sNGMon != "0";
                        }
                        if ((sNameColor != ""))
                        {
                            Monster.m_btNameColor = nNameColor;
                            Monster.m_boSetNameColor = true;
                            Monster.RefNameColor();
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfMonGenEx");
            }
        }

        private void ActionOfOpenMagicBox(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TBaseObject Monster;
            string sMonName;
            int nX = 0;
            int nY = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sMonName = QuestActionInfo.sParam1;
                if (sMonName == "")
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_OPENMAGICBOX);
                    return;
                }
                PlayObject.GetFrontPosition(ref nX, ref nY);
                Monster = M2Share.UserEngine.RegenMonsterByName(PlayObject.m_PEnvir.sMapName, nX, nY, sMonName);
                if (Monster == null)
                {
                    return;
                }
                Monster.Die();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfOpenMagicBox");
            }
        }

        private void ActionOfPkZone(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nX;
            int nY;
            TFireBurnEvent FireBurnEvent;
            int nMinX;
            int nMaxX;
            int nMinY;
            int nMaxY;
            int nRange;
            int nType;
            int nTime;
            int nPoint;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nRange = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                nType = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                nTime = HUtil32.Str_ToInt(QuestActionInfo.sParam3, -1);
                nPoint = HUtil32.Str_ToInt(QuestActionInfo.sParam4, -1);
                if ((nRange < 0) || (nType < 0) || (nTime < 0) || (nPoint < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_PKZONE);
                    return;
                }
                nMinX = this.m_nCurrX - nRange;
                nMaxX = this.m_nCurrX + nRange;
                nMinY = this.m_nCurrY - nRange;
                nMaxY = this.m_nCurrY + nRange;
                for (nX = nMinX; nX <= nMaxX; nX++)
                {
                    for (nY = nMinY; nY <= nMaxY; nY++)
                    {
                        if (((nX < nMaxX) && (nY == nMinY)) || ((nY < nMaxY) && (nX == nMinX)) || (nX == nMaxX) || (nY == nMaxY))
                        {
                            FireBurnEvent = new TFireBurnEvent(PlayObject, nX, nY, nType, Convert.ToUInt32(nTime * 1000), nPoint);
                            M2Share.g_EventManager.AddEvent(FireBurnEvent);
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfPkZone");
            }
        }

        /// <summary>
        /// 功能:设置攻击力倍数
        /// 格式:POWERRATE 倍率 有效时间
        /// 说明:倍率 为杀攻击力倍数，倍数除以100为真正的倍率(200 为 2 倍经验，150 为1.5倍)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfPowerRate(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nRate;
            int nTime;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nRate = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                nTime = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                if ((nRate < 0) || (nTime < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_POWERRATE);
                    return;
                }
                PlayObject.m_nPowerRate = nRate;
                PlayObject.m_dwPowerRateTime = (uint)nTime;
                if (M2Share.g_Config.boShowScriptActionMsg)
                {
                    // PlayObject.SysMsg(string.Format(GameMsgDef.g_sChangePowerRateMsg, new uint[] {PlayObject.m_nPowerRate / 100, PlayObject.m_dwPowerRateTime}), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfPowerRate");
            }
        }

        /// <summary>
        /// 改变特殊管理模式
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangeMode(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nMode;
            bool boOpen;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nMode = QuestActionInfo.nParam1;
                boOpen = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1) == 1;
                if (nMode >= 1 && nMode <= 3)
                {
                    switch (nMode)
                    {
                        case 1:// 管理模式
                            PlayObject.m_boAdminMode = boOpen;
                            if (PlayObject.m_boAdminMode)
                            {
                                PlayObject.SysMsg(GameMsgDef.sGameMasterMode, TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                            else
                            {
                                PlayObject.SysMsg(GameMsgDef.sReleaseGameMasterMode, TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                            break;
                        case 2:// 无敌模式
                            PlayObject.m_boSuperMan = boOpen;
                            if (PlayObject.m_boSuperMan)
                            {
                                PlayObject.SysMsg(GameMsgDef.sSupermanMode, TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                            else
                            {
                                PlayObject.SysMsg(GameMsgDef.sReleaseSupermanMode, TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                            break;
                        case 3:// 隐身模式
                            PlayObject.m_boObMode = boOpen;
                            if (PlayObject.m_boObMode)
                            {
                                PlayObject.SysMsg(GameMsgDef.sObserverMode, TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                            else
                            {
                                PlayObject.SysMsg(GameMsgDef.g_sReleaseObserverMode, TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                            break;
                    }
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEMODE);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangeMode");
            }
        }

        /// <summary>
        /// 改变管理模式
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfChangePerMission(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nPermission;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nPermission = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                if (nPermission >= 0 && nPermission <= 10)
                {
                    PlayObject.m_btPermission = (byte)nPermission;
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CHANGEPERMISSION);
                    return;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {
                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sChangePermissionMsg, PlayObject.m_btPermission), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfChangePerMission");
            }
        }

        /// <summary>
        /// 给物品
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfGiveItem(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            TUserItem UserItem = null;
            TStdItem StdItem;
            string sItemName;
            int nItemCount;
            bool boHero;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sItemName = GetLineVariableText(PlayObject, QuestActionInfo.sParam1);
                if (sItemName == "")
                {
                    sItemName = QuestActionInfo.sParam1;
                }
                nItemCount = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);// 属性 支持变量
                if (nItemCount < 0)
                {
                    nItemCount = QuestActionInfo.nParam2;
                }
                if ((sItemName == "") || (nItemCount <= 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GIVE);
                    return;
                }
                if (nItemCount <= 0)
                {
                    return;
                }
                if ((sItemName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0)
                {
                    PlayObject.IncGold(nItemCount);
                    PlayObject.GoldChanged();
                    if (M2Share.g_boGameLogGold)
                    {
                        M2Share.AddGameDataLog("9" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString() + "\09"
                            + PlayObject.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME + "\09" + (nItemCount).ToString() + "\09" + "1" + "\09" + this.m_sCharName);
                    }
                    return;
                }
                boHero = false;
                if ((QuestActionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        boHero = true;
                    }
                }
                if (M2Share.UserEngine.GetStdItemIdx(sItemName) > 0)
                {
                    if ((nItemCount <= 0) || (nItemCount > 50))
                    {
                        nItemCount = 1;// nItemCount 为0时出死循环
                    }
                    for (int i = 0; i < nItemCount; i++)
                    {
                        if (boHero)
                        {
                            if (((THeroObject)(PlayObject.m_MyHero)).IsEnoughBag())
                            {
                                UserItem = new TUserItem();
                                if (M2Share.UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                                {
                                    PlayObject.m_MyHero.m_ItemList.Add(UserItem);
                                    ((THeroObject)(PlayObject.m_MyHero)).SendAddItem(UserItem);
                                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                    if (StdItem.NeedIdentify == 1)
                                    {
                                        M2Share.AddGameDataLog("9" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09"
                                            + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_MyHero.m_sCharName + "\09" + sItemName + "\09"
                                            + (UserItem.MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem.DC)).ToString() + "/" + (HUtil32.HiWord(StdItem.DC)).ToString() + ")"
                                            + "(" + (HUtil32.LoWord(StdItem.MC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.SC)).ToString() + "/"
                                            + (HUtil32.HiWord(StdItem.SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.AC)).ToString() + "/" + (HUtil32.HiWord(StdItem.AC)).ToString() + ")" + "("
                                            + (HUtil32.LoWord(StdItem.MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MAC)).ToString() + ")" + (UserItem.btValue[0]).ToString() + "/" +
                                            (UserItem.btValue[1]).ToString() + "/" + (UserItem.btValue[2]).ToString() + "/" + (UserItem.btValue[3]).ToString() + "/" +
                                            (UserItem.btValue[4]).ToString() + "/" + (UserItem.btValue[5]).ToString() + "/" + (UserItem.btValue[6]).ToString() + "/" +
                                            (UserItem.btValue[7]).ToString() + "/" + (UserItem.btValue[8]).ToString() + "/" + (UserItem.btValue[14]).ToString() + "\09"
                                            + this.m_sCharName);
                                    }
                                }
                                else
                                {
                                    UserItem = null;
                                }
                            }
                            else
                            {
                                boHero = false;
                                if (PlayObject.IsEnoughBag())// 包裹没位则给主人
                                {
                                    UserItem = new TUserItem();
                                    if (M2Share.UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                                    {
                                        PlayObject.m_ItemList.Add(UserItem);
                                        PlayObject.SendAddItem(UserItem);
                                        StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                        if (StdItem.NeedIdentify == 1)
                                        {
                                            M2Share.AddGameDataLog("9" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" +
                                                (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + sItemName + "\09" + (UserItem.MakeIndex).ToString()
                                                + "\09" + "(" + (HUtil32.LoWord(StdItem.DC)).ToString() + "/" + (HUtil32.HiWord(StdItem.DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MC)).ToString() + "/"
                                                + (HUtil32.HiWord(StdItem.MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.SC)).ToString() + "/" + (HUtil32.HiWord(StdItem.SC)).ToString() + ")"
                                                + "(" + (HUtil32.LoWord(StdItem.AC)).ToString() + "/" + (HUtil32.HiWord(StdItem.AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MAC)).ToString()
                                                + "/" + (HUtil32.HiWord(StdItem.MAC)).ToString() + ")" + (UserItem.btValue[0]).ToString() + "/" + (UserItem.btValue[1]).ToString() + "/" +
                                                (UserItem.btValue[2]).ToString() + "/" + (UserItem.btValue[3]).ToString() + "/" + (UserItem.btValue[4]).ToString() + "/" + (UserItem.btValue[5]).ToString()
                                                + "/" + (UserItem.btValue[6]).ToString() + "/" + (UserItem.btValue[7]).ToString() + "/" + (UserItem.btValue[8]).ToString() + "/" + (UserItem.btValue[14]).ToString()
                                                + "\09" + this.m_sCharName);
                                        }
                                    }
                                    else
                                    {
                                        UserItem = null;
                                    }
                                }
                                else
                                {
                                    UserItem = new TUserItem();
                                    if (M2Share.UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                                    {
                                        StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                        if (StdItem.NeedIdentify == 1)
                                        {
                                            M2Share.AddGameDataLog("9" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString() + "\09"
                                                + PlayObject.m_sCharName + "\09" + sItemName + "\09" + (UserItem.MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem.DC)).ToString() + "/"
                                                + (HUtil32.HiWord(StdItem.DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MC)).ToString() + ")"
                                                + "(" + (HUtil32.LoWord(StdItem.SC)).ToString() + "/" + (HUtil32.HiWord(StdItem.SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.AC)).ToString()
                                                + "/" + (HUtil32.HiWord(StdItem.AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MAC)).ToString()
                                                + ")" + (UserItem.btValue[0]).ToString() + "/" + (UserItem.btValue[1]).ToString() + "/" + (UserItem.btValue[2]).ToString() + "/" + (UserItem.btValue[3]).ToString()
                                                + "/" + (UserItem.btValue[4]).ToString() + "/" + (UserItem.btValue[5]).ToString() + "/" + (UserItem.btValue[6]).ToString() + "/" + (UserItem.btValue[7]).ToString()
                                                + "/" + (UserItem.btValue[8]).ToString() + "/" + (UserItem.btValue[14]).ToString() + "\09" + this.m_sCharName);
                                        }
                                        PlayObject.DropItemDown(UserItem, 3, false, false, PlayObject, PlayObject);
                                    }
                                    else
                                    {
                                        UserItem = null;
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (PlayObject.IsEnoughBag())
                            {
                                UserItem = new TUserItem();
                                if (M2Share.UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                                {
                                    PlayObject.m_ItemList.Add(UserItem);
                                    PlayObject.SendAddItem(UserItem);
                                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                    if (StdItem.NeedIdentify == 1)
                                    {
                                        M2Share.AddGameDataLog("9" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString() + "\09"
                                            + PlayObject.m_sCharName + "\09" + sItemName + "\09" + (UserItem.MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem.DC)).ToString() + "/"
                                            + (HUtil32.HiWord(StdItem.DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MC)).ToString() + ")" + "("
                                            + (HUtil32.LoWord(StdItem.SC)).ToString() + "/" + (HUtil32.HiWord(StdItem.SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.AC)).ToString() + "/"
                                            + (HUtil32.HiWord(StdItem.AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MAC)).ToString() + ")"
                                            + (UserItem.btValue[0]).ToString() + "/" + (UserItem.btValue[1]).ToString() + "/" + (UserItem.btValue[2]).ToString()
                                            + "/" + (UserItem.btValue[3]).ToString() + "/" + (UserItem.btValue[4]).ToString() + "/" + (UserItem.btValue[5]).ToString()
                                            + "/" + (UserItem.btValue[6]).ToString() + "/" + (UserItem.btValue[7]).ToString() + "/" + (UserItem.btValue[8]).ToString()
                                            + "/" + (UserItem.btValue[14]).ToString() + "\09" + this.m_sCharName);
                                    }
                                }
                                else
                                {
                                    UserItem = null;
                                }
                            }
                            else
                            {
                                UserItem = new TUserItem();
                                if (M2Share.UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                                {
                                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                                    if (StdItem.NeedIdentify == 1)
                                    {
                                        M2Share.AddGameDataLog("9" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09"
                                            + (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + sItemName + "\09"
                                            + (UserItem.MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem.DC)).ToString() + "/" + (HUtil32.HiWord(StdItem.DC)).ToString()
                                            + ")" + "(" + (HUtil32.LoWord(StdItem.MC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MC)).ToString() + ")"
                                            + "(" + (HUtil32.LoWord(StdItem.SC)).ToString() + "/" + (HUtil32.HiWord(StdItem.SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.AC)).ToString()
                                            + "/" + (HUtil32.HiWord(StdItem.AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MAC)).ToString()
                                            + ")" + (UserItem.btValue[0]).ToString() + "/" + (UserItem.btValue[1]).ToString() + "/" + (UserItem.btValue[2]).ToString() + "/"
                                            + (UserItem.btValue[3]).ToString() + "/" + (UserItem.btValue[4]).ToString() + "/" + (UserItem.btValue[5]).ToString() + "/"
                                            + (UserItem.btValue[6]).ToString() + "/" + (UserItem.btValue[7]).ToString() + "/" + (UserItem.btValue[8]).ToString() + "/"
                                            + (UserItem.btValue[14]).ToString() + "\09" + this.m_sCharName);
                                    }
                                    PlayObject.DropItemDown(UserItem, 3, false, false, PlayObject, PlayObject);
                                }
                                else
                                {
                                    UserItem = null;
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGiveItem");
            }
        }

        private void ActionOfGmExecute(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sData;
            byte btOldPermission;
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            string sParam3 = string.Empty;
            string sParam4;
            string sParam5;
            string sParam6;
            int nParam2 = 0;
            int nParam3 = 0;
            int nParam4 = 0;
            int nParam5 = 0;
            int nParam6 = 0;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sParam1 = QuestActionInfo.sParam1;
                sParam2 = QuestActionInfo.sParam2;
                sParam3 = QuestActionInfo.sParam3;
                sParam4 = QuestActionInfo.sParam4;
                sParam5 = QuestActionInfo.sParam5;
                sParam6 = QuestActionInfo.sParam6;
                if ((sParam2 != "") && (sParam2[0] == '<') && (sParam2[1] == '$'))
                {
                    sParam2 = GetLineVariableText(PlayObject, sParam2);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sParam2, ref sParam2);
                }
                if ((sParam3 != "") && (sParam3[0] == '<') && (sParam3[1] == '$'))
                {
                    sParam3 = GetLineVariableText(PlayObject, sParam3);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sParam3, ref sParam3);
                }
                if ((sParam4 != "") && (sParam4[0] == '<') && (sParam4[1] == '$'))
                {
                    sParam4 = GetLineVariableText(PlayObject, sParam4);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sParam4, ref sParam4);
                }
                if ((sParam5 != "") && (sParam5[0] == '<') && (sParam5[1] == '$'))
                {
                    sParam5 = GetLineVariableText(PlayObject, sParam5);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sParam5, ref sParam5);
                }
                if ((sParam6 != "") && (sParam6[0] == '<') && (sParam6[1] == '$'))
                {
                    sParam6 = GetLineVariableText(PlayObject, sParam6);
                }
                else
                {
                    ScriptBase.GetValValue(PlayObject, sParam6, ref sParam6);
                }
                if (ScriptBase.GetValValue(PlayObject, sParam2, ref nParam2))
                {
                    sParam2 = (nParam2).ToString();
                }
                if (ScriptBase.GetValValue(PlayObject, sParam3, ref nParam3))
                {
                    sParam3 = (nParam3).ToString();
                }
                if (ScriptBase.GetValValue(PlayObject, sParam4, ref nParam4))
                {
                    sParam4 = (nParam4).ToString();
                }
                if (ScriptBase.GetValValue(PlayObject, sParam5, ref nParam5))
                {
                    sParam5 = (nParam5).ToString();
                }
                if (ScriptBase.GetValValue(PlayObject, sParam6, ref nParam6))
                {
                    sParam6 = (nParam6).ToString();
                }
                if ((sParam2).ToLower().CompareTo(("Self").ToLower()) == 0)
                {
                    sParam2 = PlayObject.m_sCharName;
                }
                sData = string.Format("@{0} {1} {2} {3} {4} {5}", sParam1, sParam2, sParam3, sParam4, sParam5, sParam6);
                btOldPermission = PlayObject.m_btPermission;
                try
                {
                    PlayObject.m_btPermission = 10;
                    PlayObject.ProcessUserLineMsg(sData);
                }
                finally
                {
                    PlayObject.m_btPermission = btOldPermission;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGmExecute");
            }
        }

        private void ActionOfGuildAuraePoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nAuraePoint;
            char cMethod;
            TGUild Guild;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nAuraePoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nAuraePoint < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nAuraePoint))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_AURAEPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    PlayObject.SysMsg(GameMsgDef.g_sScriptGuildAuraePointNoGuild, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        Guild.nAurae = nAuraePoint;
                        break;
                    case '-':
                        if (Guild.nAurae >= nAuraePoint)
                        {
                            Guild.nAurae = Guild.nAurae - nAuraePoint;
                        }
                        else
                        {
                            Guild.nAurae = 0;
                        }
                        break;
                    case '+':
                        if ((Int32.MaxValue - Guild.nAurae) >= nAuraePoint)
                        {
                            Guild.nAurae = Guild.nAurae + nAuraePoint;
                        }
                        else
                        {
                            Guild.nAurae = Int32.MaxValue;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {
                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sScriptGuildAuraePointMsg, new int[] { Guild.nAurae }), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGuildAuraePoint");
            }
        }

        private void ActionOfGuildBuildPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nBuildPoint;
            char cMethod;
            TGUild Guild;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nBuildPoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nBuildPoint < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nBuildPoint))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_BUILDPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    PlayObject.SysMsg(GameMsgDef.g_sScriptGuildBuildPointNoGuild, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        Guild.nBuildPoint = nBuildPoint;
                        break;
                    case '-':
                        if (Guild.nBuildPoint >= nBuildPoint)
                        {
                            Guild.nBuildPoint = Guild.nBuildPoint - nBuildPoint;
                        }
                        else
                        {
                            Guild.nBuildPoint = 0;
                        }
                        break;
                    case '+':
                        if ((Int32.MaxValue - Guild.nBuildPoint) >= nBuildPoint)
                        {
                            Guild.nBuildPoint = Guild.nBuildPoint + nBuildPoint;
                        }
                        else
                        {
                            Guild.nBuildPoint = Int32.MaxValue;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {
                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sScriptGuildBuildPointMsg, Guild.nBuildPoint), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGuildBuildPoint");
            }
        }

        private void ActionOfGuildChiefItemCount(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nItemCount;
            char cMethod;
            TGUild Guild;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nItemCount = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nItemCount < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nItemCount))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_GUILDCHIEFITEMCOUNT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    PlayObject.SysMsg(GameMsgDef.g_sScriptGuildFlourishPointNoGuild, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        Guild.nChiefItemCount = nItemCount;
                        break;
                    case '-':
                        if (Guild.nChiefItemCount >= nItemCount)
                        {
                            Guild.nChiefItemCount = Guild.nChiefItemCount - nItemCount;
                        }
                        else
                        {
                            Guild.nChiefItemCount = 0;
                        }
                        break;
                    case '+':
                        if ((Int32.MaxValue - Guild.nChiefItemCount) >= nItemCount)
                        {
                            Guild.nChiefItemCount = Guild.nChiefItemCount + nItemCount;
                        }
                        else
                        {
                            Guild.nChiefItemCount = Int32.MaxValue;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {

                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sScriptChiefItemCountMsg, new int[] { Guild.nChiefItemCount }), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGuildChiefItemCount");
            }
        }

        private void ActionOfGuildFlourishPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nFlourishPoint;
            char cMethod;
            TGUild Guild;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nFlourishPoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nFlourishPoint < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nFlourishPoint))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_FLOURISHPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    PlayObject.SysMsg(GameMsgDef.g_sScriptGuildFlourishPointNoGuild, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        Guild.nFlourishing = nFlourishPoint;
                        break;
                    case '-':
                        if (Guild.nFlourishing >= nFlourishPoint)
                        {
                            Guild.nFlourishing = Guild.nFlourishing - nFlourishPoint;
                        }
                        else
                        {
                            Guild.nFlourishing = 0;
                        }
                        break;
                    case '+':
                        if ((Int32.MaxValue - Guild.nFlourishing) >= nFlourishPoint)
                        {
                            Guild.nFlourishing = Guild.nFlourishing + nFlourishPoint;
                        }
                        else
                        {
                            Guild.nFlourishing = Int32.MaxValue;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {

                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sScriptGuildFlourishPointMsg, new int[] { Guild.nFlourishing }), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGuildFlourishPoint");
            }
        }

        private void ActionOfGuildstabilityPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nStabilityPoint;
            char cMethod;
            TGUild Guild;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nStabilityPoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nStabilityPoint < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nStabilityPoint))
                    {
                        // 增加变量支持
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_STABILITYPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    PlayObject.SysMsg(GameMsgDef.g_sScriptGuildStabilityPointNoGuild, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        Guild.nStability = nStabilityPoint;
                        break;
                    case '-':
                        if (Guild.nStability >= nStabilityPoint)
                        {
                            Guild.nStability = Guild.nStability - nStabilityPoint;
                        }
                        else
                        {
                            Guild.nStability = 0;
                        }
                        break;
                    case '+':
                        if ((Int32.MaxValue - Guild.nStability) >= nStabilityPoint)
                        {
                            Guild.nStability = Guild.nStability + nStabilityPoint;
                        }
                        else
                        {
                            Guild.nStability = Int32.MaxValue;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {

                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sScriptGuildStabilityPointMsg, new int[] { Guild.nStability }), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfGuildstabilityPoint");
            }
        }

        private void ActionOfHumanHP(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nHP;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nHP = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nHP < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nHP))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_HUMANHP);
                        return;
                    }
                }
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        PlayObject.m_WAbil.HP = nHP;
                        break;
                    case '-':
                        if (PlayObject.m_WAbil.HP >= nHP)
                        {
                            PlayObject.m_WAbil.HP -= nHP;
                        }
                        else
                        {
                            PlayObject.m_WAbil.HP = 0;
                        }
                        break;
                    case '+':
                        PlayObject.m_WAbil.HP += nHP;
                        if (PlayObject.m_WAbil.HP > PlayObject.m_WAbil.MaxHP)
                        {
                            PlayObject.m_WAbil.HP = PlayObject.m_WAbil.MaxHP;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {
                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sScriptChangeHumanHPMsg, new int[] { PlayObject.m_WAbil.MaxHP }), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfHumanHP");
            }
        }

        private void ActionOfHumanMP(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nMP;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nMP = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nMP < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nMP))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_HUMANMP);
                        return;
                    }
                }
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        PlayObject.m_WAbil.MP = nMP;
                        break;
                    case '-':
                        if (PlayObject.m_WAbil.MP >= nMP)
                        {
                            PlayObject.m_WAbil.MP -= nMP;
                        }
                        else
                        {
                            PlayObject.m_WAbil.MP = 0;
                        }
                        break;
                    case '+':
                        PlayObject.m_WAbil.MP += nMP;
                        if (PlayObject.m_WAbil.MP > PlayObject.m_WAbil.MaxMP)
                        {
                            PlayObject.m_WAbil.MP = PlayObject.m_WAbil.MaxMP;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {
                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sScriptChangeHumanMPMsg, new int[] { PlayObject.m_WAbil.MaxMP }), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfHumanMP");
            }
        }

        /// <summary>
        /// 功能:永久增加人物属性点。
        /// 格式:USEBONUSPOINT 属性位置（1-9） 控制符（+,-,=） 点数</summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfUseBonusPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nPosition = 0;
            int nCount = 0;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                if (!(QuestActionInfo.sParam1[0] >= '0' && QuestActionInfo.sParam1[1] <= '9'))
                {
                    if (QuestActionInfo.sParam1 == "DC")
                    {
                        nPosition = 1;
                    }
                    if (QuestActionInfo.sParam1 == "MC")
                    {
                        nPosition = 2;
                    }
                    if (QuestActionInfo.sParam1 == "SC")
                    {
                        nPosition = 3;
                    }
                    if (QuestActionInfo.sParam1 == "AC")
                    {
                        nPosition = 4;
                    }
                    if (QuestActionInfo.sParam1 == "MAC")
                    {
                        nPosition = 5;
                    }
                    if (QuestActionInfo.sParam1 == "HP")
                    {
                        nPosition = 6;
                    }
                    if (QuestActionInfo.sParam1 == "MP")
                    {
                        nPosition = 7;
                    }
                    if (QuestActionInfo.sParam1 == "Hit")
                    {
                        nPosition = 8;
                    }
                    if (QuestActionInfo.sParam1 == "SPD")
                    {
                        nPosition = 9;
                    }
                }
                else
                {
                    nPosition = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), -1);
                }
                cMethod = QuestActionInfo.sParam2[1];
                nCount = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam3), -1);
                if ((nPosition < 0) || (nCount < 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_USEBONUSPOINT);
                    return;
                }
                if ((QuestActionInfo.sParam4).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                    {
                        // ScriptActionError(PlayObject, '', QuestActionInfo, sSC_USEBONUSPOINT);
                        return;
                    }
                    if (PlayObject.m_MyHero != null)
                    {
                        switch (cMethod)
                        {
                            case '+':
                                switch (nPosition)
                                {
                                    case 1:
                                        PlayObject.m_MyHero.m_BonusAbil.DC += (ushort)nCount;
                                        break;
                                    case 2:
                                        PlayObject.m_MyHero.m_BonusAbil.MC += (ushort)nCount;
                                        break;
                                    case 3:
                                        PlayObject.m_MyHero.m_BonusAbil.SC += (ushort)nCount;
                                        break;
                                    case 4:
                                        PlayObject.m_MyHero.m_BonusAbil.AC += (ushort)nCount;
                                        break;
                                    case 5:
                                        PlayObject.m_MyHero.m_BonusAbil.MAC += (ushort)nCount;
                                        break;
                                    case 6:
                                        PlayObject.m_MyHero.m_BonusAbil.HP += (ushort)nCount;
                                        break;
                                    case 7:
                                        PlayObject.m_MyHero.m_BonusAbil.MP += (ushort)nCount;
                                        break;
                                    case 8:
                                        PlayObject.m_MyHero.m_BonusAbil.Hit += (ushort)nCount;
                                        break;
                                    case 9:
                                        PlayObject.m_MyHero.m_BonusAbil.Speed += (ushort)nCount;
                                        break;
                                }
                                break;
                            case '-':
                                switch (nPosition)
                                {
                                    case 1:
                                        PlayObject.m_MyHero.m_BonusAbil.DC -= (ushort)nCount;
                                        break;
                                    case 2:
                                        PlayObject.m_MyHero.m_BonusAbil.MC -= (ushort)nCount;
                                        break;
                                    case 3:
                                        PlayObject.m_MyHero.m_BonusAbil.SC -= (ushort)nCount;
                                        break;
                                    case 4:
                                        PlayObject.m_MyHero.m_BonusAbil.AC -= (ushort)nCount;
                                        break;
                                    case 5:
                                        PlayObject.m_MyHero.m_BonusAbil.MAC -= (ushort)nCount;
                                        break;
                                    case 6:
                                        PlayObject.m_MyHero.m_BonusAbil.HP -= (ushort)nCount;
                                        break;
                                    case 7:
                                        PlayObject.m_MyHero.m_BonusAbil.MP -= (ushort)nCount;
                                        break;
                                    case 8:
                                        PlayObject.m_MyHero.m_BonusAbil.Hit -= (ushort)nCount;
                                        break;
                                    case 9:
                                        PlayObject.m_MyHero.m_BonusAbil.Speed -= (ushort)nCount;
                                        break;
                                }
                                break;
                            case '=':
                                switch (nPosition)
                                {
                                    case 1:
                                        PlayObject.m_MyHero.m_BonusAbil.DC = (ushort)nCount;
                                        break;
                                    case 2:
                                        PlayObject.m_MyHero.m_BonusAbil.MC = (ushort)nCount;
                                        break;
                                    case 3:
                                        PlayObject.m_MyHero.m_BonusAbil.SC = (ushort)nCount;
                                        break;
                                    case 4:
                                        PlayObject.m_MyHero.m_BonusAbil.AC = (ushort)nCount;
                                        break;
                                    case 5:
                                        PlayObject.m_MyHero.m_BonusAbil.MAC = (ushort)nCount;
                                        break;
                                    case 6:
                                        PlayObject.m_MyHero.m_BonusAbil.HP = (ushort)nCount;
                                        break;
                                    case 7:
                                        PlayObject.m_MyHero.m_BonusAbil.MP = (ushort)nCount;
                                        break;
                                    case 8:
                                        PlayObject.m_MyHero.m_BonusAbil.Hit = (ushort)nCount;
                                        break;
                                    case 9:
                                        PlayObject.m_MyHero.m_BonusAbil.Speed = (ushort)nCount;
                                        break;
                                }
                                break;
                        }
                        ((THeroObject)(PlayObject.m_MyHero)).RecalcAbilitys();
                        PlayObject.m_MyHero.CompareSuitItem(false);// 套装
                        ((THeroObject)(PlayObject.m_MyHero)).SendMsg(PlayObject.m_MyHero, Grobal2.RM_HEROABILITY, 0, 0, 0, 0, "");// 发送英雄属性
                        ((THeroObject)(PlayObject.m_MyHero)).SendMsg(PlayObject.m_MyHero, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                    }
                }
                else
                {
                    switch (cMethod)
                    {
                        case '+':
                            switch (nPosition)
                            {
                                case 1:
                                    PlayObject.m_BonusAbil.DC += (ushort)nCount;
                                    break;
                                case 2:
                                    PlayObject.m_BonusAbil.MC += (ushort)nCount;
                                    break;
                                case 3:
                                    PlayObject.m_BonusAbil.SC += (ushort)nCount;
                                    break;
                                case 4:
                                    PlayObject.m_BonusAbil.AC += (ushort)nCount;
                                    break;
                                case 5:
                                    PlayObject.m_BonusAbil.MAC += (ushort)nCount;
                                    break;
                                case 6:
                                    PlayObject.m_BonusAbil.HP += (ushort)nCount;
                                    break;
                                case 7:
                                    PlayObject.m_BonusAbil.MP += (ushort)nCount;
                                    break;
                                case 8:
                                    PlayObject.m_BonusAbil.Hit += (ushort)nCount;
                                    break;
                                case 9:
                                    PlayObject.m_BonusAbil.Speed += (ushort)nCount;
                                    break;
                            }
                            break;
                        case '-':
                            switch (nPosition)
                            {
                                case 1:
                                    PlayObject.m_BonusAbil.DC -= (ushort)nCount;
                                    break;
                                case 2:
                                    PlayObject.m_BonusAbil.MC -= (ushort)nCount;
                                    break;
                                case 3:
                                    PlayObject.m_BonusAbil.SC -= (ushort)nCount;
                                    break;
                                case 4:
                                    PlayObject.m_BonusAbil.AC -= (ushort)nCount;
                                    break;
                                case 5:
                                    PlayObject.m_BonusAbil.MAC -= (ushort)nCount;
                                    break;
                                case 6:
                                    PlayObject.m_BonusAbil.HP -= (ushort)nCount;
                                    break;
                                case 7:
                                    PlayObject.m_BonusAbil.MP -= (ushort)nCount;
                                    break;
                                case 8:
                                    PlayObject.m_BonusAbil.Hit -= (ushort)nCount;
                                    break;
                                case 9:
                                    PlayObject.m_BonusAbil.Speed -= (ushort)nCount;
                                    break;
                            }
                            break;
                        case '=':
                            switch (nPosition)
                            {
                                case 1:
                                    PlayObject.m_BonusAbil.DC = (ushort)nCount;
                                    break;
                                case 2:
                                    PlayObject.m_BonusAbil.MC = (ushort)nCount;
                                    break;
                                case 3:
                                    PlayObject.m_BonusAbil.SC = (ushort)nCount;
                                    break;
                                case 4:
                                    PlayObject.m_BonusAbil.AC = (ushort)nCount;
                                    break;
                                case 5:
                                    PlayObject.m_BonusAbil.MAC = (ushort)nCount;
                                    break;
                                case 6:
                                    PlayObject.m_BonusAbil.HP = (ushort)nCount;
                                    break;
                                case 7:
                                    PlayObject.m_BonusAbil.MP = (ushort)nCount;
                                    break;
                                case 8:
                                    PlayObject.m_BonusAbil.Hit = (ushort)nCount;
                                    break;
                                case 9:
                                    PlayObject.m_BonusAbil.Speed = (ushort)nCount;
                                    break;
                            }
                            break;
                    }
                    PlayObject.RecalcAbilitys();
                    PlayObject.CompareSuitItem(false);
                    PlayObject.SendMsg(PlayObject, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                    PlayObject.SendMsg(PlayObject, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfUseBonusPoint");
            }
        }

        /// <summary>
        /// 功能：干掉所有在线玩家
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfKick(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.m_boKickFlag = true;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfKick");
            }
        }

        /// <summary>
        /// 功能：干掉指定玩家
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfKill(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nMode;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nMode = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                if (nMode >= 0 && nMode <= 3)
                {
                    switch (nMode)
                    {
                        case 1:
                            PlayObject.m_boNoItem = true;
                            PlayObject.Die();
                            break;
                        case 2:
                            PlayObject.SetLastHiter(this);
                            PlayObject.Die();
                            break;
                        case 3:
                            PlayObject.m_boNoItem = true;
                            PlayObject.SetLastHiter(this);
                            PlayObject.Die();
                            break;
                        default:
                            PlayObject.Die();
                            break;
                    }
                }
                else
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_KILL);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfKill");
            }
        }

        private void ActionOfBonusPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nBonusPoint;
            char cMethod;
            try
            {
                nBonusPoint = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nBonusPoint < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nBonusPoint);// 增加变量支持
                }
                if ((nBonusPoint < 0) || (nBonusPoint > 10000))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_BONUSPOINT);
                    return;
                }
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        //FillChar(PlayObject.m_BonusAbil, sizeof(TNakedAbility), '\0');
                        PlayObject.HasLevelUp(0);
                        PlayObject.m_nBonusPoint = nBonusPoint;
                        PlayObject.SendMsg(PlayObject, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                        break;
                    case '-':
                        if (PlayObject.m_nBonusPoint >= nBonusPoint)
                        {
                            PlayObject.m_nBonusPoint -= nBonusPoint;
                        }
                        else
                        {
                            PlayObject.m_nBonusPoint = 0;
                        }
                        PlayObject.SendMsg(PlayObject, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                        break;
                    case '+':
                        PlayObject.m_nBonusPoint += nBonusPoint;
                        PlayObject.SendMsg(PlayObject, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfBonusPoint");
            }
        }

        private void ActionOfDelMarry(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.m_sDearName = "";
                PlayObject.RefShowName();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfDelMarry");
            }
        }

        private void ActionOfDelMaster(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.m_sMasterName = "";
                PlayObject.RefShowName();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfDelMaster");
            }
        }

        private void ActionOfRestBonusPoint(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nTotleUsePoint;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nTotleUsePoint = PlayObject.m_BonusAbil.DC + PlayObject.m_BonusAbil.MC + PlayObject.m_BonusAbil.SC + PlayObject.m_BonusAbil.AC + PlayObject.m_BonusAbil.MAC
                    + PlayObject.m_BonusAbil.HP + PlayObject.m_BonusAbil.MP + PlayObject.m_BonusAbil.Hit + PlayObject.m_BonusAbil.Speed + PlayObject.m_BonusAbil.X2;
                //FillChar(PlayObject.m_BonusAbil, sizeof(TNakedAbility), '\0');
                PlayObject.m_nBonusPoint += nTotleUsePoint;
                PlayObject.SendMsg(PlayObject, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                PlayObject.HasLevelUp(0);
                PlayObject.SysMsg("分配点数已复位！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfRestBonusPoint");
            }
        }

        private void ActionOfRestReNewLevel(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.m_btReLevel = 0;
                PlayObject.HasLevelUp(0);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfRestReNewLevel");
            }
        }

        private void ActionOfSetMapMode(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            Envirnoment Envir;
            string sMapName;
            string sMapMode;
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sMapName = QuestActionInfo.sParam1;
                sMapMode = QuestActionInfo.sParam2;
                sParam1 = QuestActionInfo.sParam3;
                sParam2 = QuestActionInfo.sParam4;
                Envir = M2Share.g_MapManager.FindMap(sMapName);
                if ((Envir == null) || (sMapMode == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SETMAPMODE);
                    return;
                }
                if ((sMapMode).ToLower().CompareTo(("SAFE").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boSAFE = true;
                    }
                    else
                    {
                        Envir.m_boSAFE = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("DARK").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boDARK = true;
                    }
                    else
                    {
                        Envir.m_boDARK = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("DARK").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boDARK = true;
                    }
                    else
                    {
                        Envir.m_boDARK = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("FIGHT").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boFightZone = true;
                    }
                    else
                    {
                        Envir.m_boFightZone = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("FIGHT2").ToLower()) == 0)
                {
                    // PK掉装备地图
                    if ((sParam1 != ""))
                    {
                        Envir.m_boFight2Zone = true;
                    }
                    else
                    {
                        Envir.m_boFight2Zone = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("FIGHT3").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boFight3Zone = true;
                    }
                    else
                    {
                        Envir.m_boFight3Zone = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("FIGHT4").ToLower()) == 0)
                {
                    // 挑战地图 20080706
                    if ((sParam1 != ""))
                    {
                        Envir.m_boFight4Zone = true;
                    }
                    else
                    {
                        Envir.m_boFight4Zone = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("DAY").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boDAY = true;
                    }
                    else
                    {
                        Envir.m_boDAY = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("QUIZ").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boQUIZ = true;
                    }
                    else
                    {
                        Envir.m_boQUIZ = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NORECONNECT").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNORECONNECT = true;
                        Envir.sNoReconnectMap = sParam1;
                    }
                    else
                    {
                        Envir.m_boNORECONNECT = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("MUSIC").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boMUSIC = true;
                        Envir.m_nMUSICID = HUtil32.Str_ToInt(sParam1, -1);
                    }
                    else
                    {
                        Envir.m_boMUSIC = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("EXPRATE").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boEXPRATE = true;
                        Envir.m_nEXPRATE = HUtil32.Str_ToInt(sParam1, -1);
                    }
                    else
                    {
                        Envir.m_boEXPRATE = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("PKWINLEVEL").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boPKWINLEVEL = true;
                        Envir.m_nPKWINLEVEL = HUtil32.Str_ToInt(sParam1, -1);
                    }
                    else
                    {
                        Envir.m_boPKWINLEVEL = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("PKWINEXP").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boPKWINEXP = true;
                        Envir.m_nPKWINEXP = HUtil32.Str_ToInt(sParam1, -1);
                    }
                    else
                    {
                        Envir.m_boPKWINEXP = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("PKLOSTLEVEL").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boPKLOSTLEVEL = true;
                        Envir.m_nPKLOSTLEVEL = HUtil32.Str_ToInt(sParam1, -1);
                    }
                    else
                    {
                        Envir.m_boPKLOSTLEVEL = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("PKLOSTEXP").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boPKLOSTEXP = true;
                        Envir.m_nPKLOSTEXP = HUtil32.Str_ToInt(sParam1, -1);
                    }
                    else
                    {
                        Envir.m_boPKLOSTEXP = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("DECHP").ToLower()) == 0)
                {
                    if ((sParam1 != "") && (sParam2 != ""))
                    {
                        Envir.m_boDECHP = true;
                        Envir.m_nDECHPTIME = HUtil32.Str_ToInt(sParam1, -1);
                        Envir.m_nDECHPPOINT = HUtil32.Str_ToInt(sParam2, -1);
                    }
                    else
                    {
                        Envir.m_boDECHP = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("DECGAMEGOLD").ToLower()) == 0)
                {
                    if ((sParam1 != "") && (sParam2 != ""))
                    {
                        Envir.m_boDecGameGold = true;
                        Envir.m_nDECGAMEGOLDTIME = HUtil32.Str_ToInt(sParam1, -1);
                        Envir.m_nDecGameGold = HUtil32.Str_ToInt(sParam2, -1);
                    }
                    else
                    {
                        Envir.m_boDecGameGold = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("RUNHUMAN").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boRUNHUMAN = true;
                    }
                    else
                    {
                        Envir.m_boRUNHUMAN = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("RUNMON").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boRUNMON = true;
                    }
                    else
                    {
                        Envir.m_boRUNMON = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NEEDHOLE").ToLower()) == 0)// 进入需要洞
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNEEDHOLE = true;
                    }
                    else
                    {
                        Envir.m_boNEEDHOLE = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NORECALL").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNORECALL = true;
                    }
                    else
                    {
                        Envir.m_boNORECALL = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NOGUILDRECALL").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNOGUILDRECALL = true;
                    }
                    else
                    {
                        Envir.m_boNOGUILDRECALL = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NODEARRECALL").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNODEARRECALL = true;
                    }
                    else
                    {
                        Envir.m_boNODEARRECALL = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NOMASTERRECALL").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNOMASTERRECALL = true;
                    }
                    else
                    {
                        Envir.m_boNOMASTERRECALL = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NORANDOMMOVE").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNORANDOMMOVE = true;
                    }
                    else
                    {
                        Envir.m_boNORANDOMMOVE = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NODRUG").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNODRUG = true;
                    }
                    else
                    {
                        Envir.m_boNODRUG = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("MINE").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boMINE = true;
                    }
                    else
                    {
                        Envir.m_boMINE = false;
                    }
                }
                else if ((sMapMode).ToLower().CompareTo(("NOPOSITIONMOVE").ToLower()) == 0)
                {
                    if ((sParam1 != ""))
                    {
                        Envir.m_boNOPOSITIONMOVE = true;
                    }
                    else
                    {
                        Envir.m_boNOPOSITIONMOVE = false;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSetMapMode");
            }
        }

        private void ActionOfSetMemberLevel(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nLevel;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nLevel = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nLevel < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nLevel))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SETMEMBERLEVEL);
                        return;
                    }
                }
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        PlayObject.m_nMemberLevel = nLevel;
                        break;
                    case '-':
                        PlayObject.m_nMemberLevel -= nLevel;
                        if (PlayObject.m_nMemberLevel < 0)
                        {
                            PlayObject.m_nMemberLevel = 0;
                        }
                        break;
                    case '+':
                        PlayObject.m_nMemberLevel += nLevel;
                        if (PlayObject.m_nMemberLevel > 65535)
                        {
                            PlayObject.m_nMemberLevel = 65535;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {

                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sChangeMemberLevelMsg, new int[] { PlayObject.m_nMemberLevel }), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSetMemberLevel");
            }
        }

        private void ActionOfSetMemberType(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nType;
            char cMethod;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nType = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam2), -1);
                if (nType < 0)
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nType))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SETMEMBERTYPE);
                        return;
                    }
                }
                cMethod = QuestActionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        PlayObject.m_nMemberType = nType;
                        break;
                    case '-':
                        PlayObject.m_nMemberType -= nType;
                        if (PlayObject.m_nMemberType < 0)
                        {
                            PlayObject.m_nMemberType = 0;
                        }
                        break;
                    case '+':
                        PlayObject.m_nMemberType += nType;
                        if (PlayObject.m_nMemberType > 65535)
                        {
                            PlayObject.m_nMemberType = 65535;
                        }
                        break;
                }
                if (M2Share.g_Config.boShowScriptActionMsg)
                {

                    PlayObject.SysMsg(string.Format(GameMsgDef.g_sChangeMemberTypeMsg, new int[] { PlayObject.m_nMemberType }), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSetMemberType");
            }
        }


        private void ActionOfClearNeedItems(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nNeed;
            TUserItem UserItem;
            TStdItem StdItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nNeed = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, QuestActionInfo.sParam1), -1);
                if ((nNeed < 0))
                {
                    if (!ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nNeed))
                    {
                        ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CLEARNEEDITEMS);
                        return;
                    }
                }
                for (int i = PlayObject.m_ItemList.Count - 1; i >= 0; i--)
                {
                    if (PlayObject.m_ItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem)PlayObject.m_ItemList[i];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                    if ((StdItem != null) && (StdItem.Need == nNeed))
                    {
                        PlayObject.SendDelItems(UserItem);
                        UserItem = null;//Marshal.FreeHGlobal(UserItem);//By Dr.Kevin修正此处内存泄漏
                        PlayObject.m_ItemList.RemoveAt(i);
                    }
                }
                for (int i = PlayObject.m_StorageItemList.Count - 1; i >= 0; i--)
                {
                    if (PlayObject.m_StorageItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = PlayObject.m_StorageItemList[i];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                    if ((StdItem != null) && (StdItem.Need == nNeed))
                    {
                        UserItem = null;//UserItem=null;//By Dr.Kevin修正此处内存泄漏
                        PlayObject.m_StorageItemList.RemoveAt(i);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfClearNeedItems");
            }
        }

        private void ActionOfClearMakeItems(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nMakeIndex;
            string sItemName;
            TUserItem UserItem;
            TStdItem StdItem;
            bool boMatchName;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sItemName = QuestActionInfo.sParam1;
                nMakeIndex = QuestActionInfo.nParam2;
                boMatchName = QuestActionInfo.sParam3 == "1";
                if ((sItemName == "") || (nMakeIndex <= 0))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CLEARMAKEITEMS);
                    return;
                }
                for (int i = PlayObject.m_ItemList.Count - 1; i >= 0; i--)
                {
                    if (PlayObject.m_ItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem)PlayObject.m_ItemList[i];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    if (UserItem.MakeIndex != nMakeIndex)
                    {
                        continue;
                    }
                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                    if (!boMatchName || ((StdItem != null) && (StdItem.Name.ToLower().CompareTo((sItemName).ToLower()) == 0)))
                    {
                        PlayObject.SendDelItems(UserItem);
                        UserItem = null;//By Dr.Kevin修正此处内存泄漏
                        PlayObject.m_ItemList.RemoveAt(i);
                    }
                }
                for (int i = PlayObject.m_StorageItemList.Count - 1; i >= 0; i--)
                {
                    if (PlayObject.m_StorageItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem)PlayObject.m_ItemList[i];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    if (UserItem.MakeIndex != nMakeIndex)
                    {
                        continue;
                    }
                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                    if (!boMatchName || ((StdItem != null) && (StdItem.Name.ToLower().CompareTo((sItemName).ToLower()) == 0)))
                    {
                        UserItem = null;
                        PlayObject.m_StorageItemList.RemoveAt(i);
                    }
                }
                for (int i = PlayObject.m_UseItems.GetLowerBound(0); i <= PlayObject.m_UseItems.GetUpperBound(0); i++)
                {
                    UserItem = PlayObject.m_UseItems[i];
                    if (UserItem.MakeIndex != nMakeIndex)
                    {
                        continue;
                    }
                    StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                    if (!boMatchName || ((StdItem != null) && (StdItem.Name.ToLower().CompareTo((sItemName).ToLower()) == 0)))
                    {
                        UserItem.wIndex = 0;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfClearMakeItems");
            }
        }


        /// <summary>
        /// 升级物品
        /// </summary>
        private void ActionOfUpgradeItems(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nRate;
            int nWhere;
            int nValType;
            int nPoint;
            int nAddPoint;
            TUserItem UserItem = null;
            TStdItem StdItem;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nWhere = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                nRate = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                nPoint = HUtil32.Str_ToInt(QuestActionInfo.sParam3, -1);
                if (nWhere < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nWhere); // 增加变量支持
                }
                if (nRate < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nRate);// 增加变量支持
                }
                if (nPoint < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref nPoint);// 增加变量支持
                }
                if ((nWhere < 0) || (nWhere > m_UseItems.GetUpperBound(0)) || (nRate < 0) || (nPoint < 0) || (nPoint > 255))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_UPGRADEITEMS);
                    return;
                }
                UserItem = PlayObject.m_UseItems[nWhere];
                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                if ((UserItem.wIndex <= 0) || (StdItem == null))
                {
                    PlayObject.SysMsg("您身上没有戴指定物品！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                nRate = HUtil32.Random(nRate);
                nPoint = HUtil32.Random(nPoint);
                nValType = HUtil32.Random(16);
                if (nRate != 0)
                {
                    PlayObject.SysMsg("装备升级失败！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                UserItem.btValue[9] = (byte)HUtil32._MIN(255, UserItem.btValue[9] + 1);// 累积升级次数
                if ((nValType == 15) && (StdItem.Shape == 188)) // 吸伤属性
                {
                    UserItem.btValue[20] = Convert.ToByte(UserItem.btValue[20] + nPoint);
                    if (UserItem.btValue[20] > 100)
                    {
                        UserItem.btValue[20] = 100;
                    }
                }
                else if (nValType == 14)
                {
                    nAddPoint = (nPoint * 1000);
                    if (UserItem.DuraMax + nAddPoint > ushort.MaxValue)
                    {
                        nAddPoint = ushort.MaxValue - UserItem.DuraMax;
                    }
                    UserItem.DuraMax = Convert.ToUInt16(UserItem.DuraMax + nAddPoint);
                }
                else
                {
                    nAddPoint = nPoint;
                    if (UserItem.btValue[nValType] + nAddPoint > Byte.MaxValue)
                    {
                        nAddPoint = Byte.MaxValue - UserItem.btValue[nValType];
                    }
                    UserItem.btValue[nValType] = Convert.ToByte(UserItem.btValue[nValType] + nAddPoint);
                    if (StdItem.NeedIdentify == 1)
                    {
                        M2Share.AddGameDataLog("31" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString()
                            + "\09" + PlayObject.m_sCharName + "\09" + StdItem.Name + "\09" + (UserItem.MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem.DC)).ToString()
                            + "/" + (HUtil32.HiWord(StdItem.DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MC)).ToString() + ")"
                            + "(" + (HUtil32.LoWord(StdItem.SC)).ToString() + "/" + (HUtil32.HiWord(StdItem.SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.AC)).ToString() + "/" +
                            (HUtil32.HiWord(StdItem.AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem.MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem.MAC)).ToString() + ")"
                            + (UserItem.btValue[0]).ToString() + "/" + (UserItem.btValue[1]).ToString() + "/" + (UserItem.btValue[2]).ToString() + "/" + (UserItem.btValue[3]).ToString()
                            + "/" + UserItem.btValue[4] + "/" + (UserItem.btValue[5]).ToString() + "/" + (UserItem.btValue[6]).ToString() + "/" + (UserItem.btValue[7]).ToString()
                            + "/" + UserItem.btValue[8] + "/" + (UserItem.btValue[14]).ToString() + "\09" + (UserItem.Dura).ToString() + "/" + (UserItem.DuraMax).ToString());
                    }
                }
                PlayObject.SendUpdateItem(UserItem);
                PlayObject.SysMsg("装备升级成功", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfUpgradeItems");
            }
        }

        /// <summary>
        /// 升级物品
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestActionInfo"></param>
        private void ActionOfUpgradeItemsEx(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            int nRate;
            int nWhere;
            int nValType;
            int nPoint;
            int nAddPoint;
            TUserItem UserItem;
            TStdItem StdItem;
            int nUpgradeItemStatus;
            int nRatePoint;
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                nWhere = HUtil32.Str_ToInt(QuestActionInfo.sParam1, -1);
                nValType = HUtil32.Str_ToInt(QuestActionInfo.sParam2, -1);
                nRate = HUtil32.Str_ToInt(QuestActionInfo.sParam3, -1);
                nPoint = HUtil32.Str_ToInt(QuestActionInfo.sParam4, -1);
                if (nWhere < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam1, ref nWhere);
                }
                if (nValType < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam2, ref nValType);
                }
                if (nRate < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam3, ref nRate);
                }
                if (nPoint < 0)
                {
                    ScriptBase.GetValValue(PlayObject, QuestActionInfo.sParam4, ref nPoint);
                }
                nUpgradeItemStatus = HUtil32.Str_ToInt(QuestActionInfo.sParam5, -1);
                if ((nValType < 0) || (nValType > 15) || (nWhere < 0) || (nWhere > m_UseItems.GetUpperBound(0)) || (nRate < 0) || (nPoint < 0) || (nPoint > 255))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_UPGRADEITEMSEX);
                    return;
                }
                UserItem = PlayObject.m_UseItems[nWhere];
                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                if ((UserItem.wIndex <= 0) || (StdItem == null))
                {
                    PlayObject.SysMsg("您身上没有戴指定物品！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                nRatePoint = HUtil32.Random(nRate * 10);
                nPoint = HUtil32._MAX(1, HUtil32.Random(nPoint));
                if (!(nRatePoint >= 0 && nRatePoint <= 10))
                {
                    switch (nUpgradeItemStatus)
                    {
                        case 0:
                            PlayObject.SysMsg("装备升级未成功！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                            break;
                        case 1:
                            PlayObject.SendDelItems(UserItem);
                            UserItem.wIndex = 0;
                            PlayObject.SysMsg("装备破碎！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                            break;
                        case 2:
                            PlayObject.SysMsg("装备升级失败，装备属性恢复默认！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                            if (nValType != 14)
                            {
                                UserItem.btValue[nValType] = 0;
                            }
                            if ((nValType == 15) && (StdItem.Shape == 188))
                            {
                                UserItem.btValue[20] = 0;
                            }
                            break;
                    }
                    return;
                }
                UserItem.btValue[9] = (byte)HUtil32._MIN(255, UserItem.btValue[9] + 1);// 累积升级次数
                if ((nValType == 15) && (StdItem.Shape == 188))// 吸收伤害属性
                {
                    UserItem.btValue[20] = Convert.ToByte(UserItem.btValue[20] + nPoint);
                    if (UserItem.btValue[20] > 100)
                    {
                        UserItem.btValue[20] = 100;
                    }
                }
                else if (nValType == 14)
                {
                    nAddPoint = (nPoint * 1000);
                    if (UserItem.DuraMax + nAddPoint > ushort.MaxValue)
                    {
                        nAddPoint = ushort.MaxValue - UserItem.DuraMax;
                    }
                    UserItem.DuraMax = Convert.ToUInt16(UserItem.DuraMax + nAddPoint);
                }
                else
                {
                    nAddPoint = nPoint;
                    if (UserItem.btValue[nValType] + nAddPoint > Byte.MaxValue)
                    {
                        nAddPoint = Byte.MaxValue - UserItem.btValue[nValType];
                    }
                    UserItem.btValue[nValType] = Convert.ToByte(UserItem.btValue[nValType] + nAddPoint);
                }
                PlayObject.SendUpdateItem(UserItem);
                PlayObject.SysMsg("装备升级成功", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfUpgradeItemsEx");
            }
        }

        // 声明变量
        // VAR 数据类型(Integer string) 类型(HUMAN GUILD GLOBAL) 变量值
        private void ActionOfVar(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sType;
            TVarType VarType;
            string sVarName;
            string sVarValue;
            int nVarValue;
            string sName = string.Empty;
            TDynamicVar DynamicVar;
            bool boFoundVar;
            IList<TDynamicVar> DynamicVarList;
            const string sVarFound = "变量%s已存在，变量类型:{0}";
            const string sVarTypeError = "变量类型错误，错误类型:%s 当前支持类型(HUMAN、GUILD、GLOBAL)";
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sType = QuestActionInfo.sParam2;
                sVarName = QuestActionInfo.sParam3;
                sVarValue = QuestActionInfo.sParam4;
                nVarValue = HUtil32.Str_ToInt(QuestActionInfo.sParam4, 0);
                VarType = TVarType.vNone;
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("Integer").ToLower()) == 0)
                {
                    VarType = TVarType.vInteger;
                }
                if ((QuestActionInfo.sParam1).ToLower().CompareTo(("string").ToLower()) == 0)
                {
                    VarType = TVarType.vString;
                }
                if ((sType == "") || (sVarName == "") || (VarType == TVarType.vNone))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_VAR);
                    return;
                }
                DynamicVar = new TDynamicVar();
                DynamicVar.sName = sVarName;
                DynamicVar.VarType = VarType;
                DynamicVar.nInternet = nVarValue;
                DynamicVar.sString = sVarValue;
                boFoundVar = false;
                DynamicVarList = GetDynamicVarList(PlayObject, sType, ref sName);
                if (DynamicVarList == null)
                {
                    Dispose(DynamicVar);
                    ScriptActionError(PlayObject, string.Format(sVarTypeError, sType), QuestActionInfo, M2Share.sSC_VAR);
                    return;
                }
                if (DynamicVarList.Count > 0)
                {
                    for (int i = 0; i < DynamicVarList.Count; i++)
                    {
                        if (DynamicVarList[i].sName.ToLower().CompareTo((sVarName).ToLower()) == 0)
                        {
                            boFoundVar = true;
                            break;
                        }
                    }
                }
                if (!boFoundVar)
                {
                    DynamicVarList.Add(DynamicVar);
                }
                else
                {
                    Dispose(DynamicVar);
                    ScriptActionError(PlayObject, string.Format(sVarFound, sVarName, sType), QuestActionInfo, M2Share.sSC_VAR);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfVar");
            }
        }

        /// <summary>
        /// 读取变量值
        /// LOADVAR 变量类型 变量名 文件名
        /// </summary>
        private void ActionOfLoadVar(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sType;
            string sVarName = string.Empty;
            string sFileName = string.Empty;
            string sName = string.Empty;
            TDynamicVar DynamicVar;
            bool boFoundVar;
            IList<TDynamicVar> DynamicVarList;
            IniFile IniFile;
            const string sVarFound = "变量%s不存在，变量类型:%s";
            const string sVarTypeError = "变量类型错误，错误类型:%s 当前支持类型(HUMAN、GUILD、GLOBAL)";
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sType = QuestActionInfo.sParam1;
                sVarName = QuestActionInfo.sParam2;
                sFileName = QuestActionInfo.sParam3;
                if (sFileName[0] == '\\')
                {
                    sFileName = sFileName.Substring(2 - 1, sFileName.Length - 1);
                }
                if (sFileName[1] == '\\')
                {
                    sFileName = sFileName.Substring(3 - 1, sFileName.Length - 2);
                }
                if (sFileName[2] == '\\')
                {
                    sFileName = sFileName.Substring(4 - 1, sFileName.Length - 3);
                }
                sFileName = M2Share.g_Config.sEnvirDir + sFileName;
                if ((sType == "") || (sVarName == "") || !File.Exists(sFileName))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_LOADVAR);
                    return;
                }
                boFoundVar = false;
                DynamicVarList = GetDynamicVarList(PlayObject, sType, ref sName);
                if (DynamicVarList == null)
                {

                    ScriptActionError(PlayObject, string.Format(sVarTypeError, new string[] { sType }), QuestActionInfo, M2Share.sSC_VAR);
                    return;
                }
                else
                {
                    IniFile = new IniFile(sFileName);
                    try
                    {
                        if (DynamicVarList.Count > 0)
                        {
                            for (int i = 0; i < DynamicVarList.Count; i++)
                            {
                                DynamicVar = DynamicVarList[i];
                                if (DynamicVar != null)
                                {
                                    if ((DynamicVar.sName).ToLower().CompareTo((sVarName).ToLower()) == 0)
                                    {
                                        switch (DynamicVar.VarType)
                                        {
                                            case TVarType.vInteger:
                                                DynamicVar.nInternet = IniFile.ReadInteger(sName, DynamicVar.sName, 0);
                                                break;
                                            case TVarType.vString:
                                                DynamicVar.sString = IniFile.ReadString(sName, DynamicVar.sName, "");
                                                break;
                                        }
                                        boFoundVar = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!boFoundVar)
                        {
                            ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sVarName, sType }), QuestActionInfo, M2Share.sSC_LOADVAR);
                        }
                    }
                    finally
                    {
                        Dispose(IniFile);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfLoadVar");
            }
        }

        // 保存变量值
        // SAVEVAR 变量类型 变量名 文件名
        private void ActionOfSaveVar(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sType;
            string sVarName;
            string sFileName;
            string sName = string.Empty;
            TDynamicVar DynamicVar;
            bool boFoundVar;
            IList<TDynamicVar> DynamicVarList;
            IniFile IniFile;
            const string sVarFound = "变量{0}不存在，变量类型:{1}";
            const string sVarTypeError = "变量类型错误，错误类型:{0} 当前支持类型(HUMAN、GUILD、GLOBAL)";
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sType = QuestActionInfo.sParam1;
                sVarName = QuestActionInfo.sParam2;
                sFileName = QuestActionInfo.sParam3;
                if (sFileName[0] == '\\')
                {
                    sFileName = sFileName.Substring(2 - 1, sFileName.Length - 1);
                }
                // 增加,处理文件路径
                if (sFileName[1] == '\\')
                {
                    sFileName = sFileName.Substring(3 - 1, sFileName.Length - 2);
                }
                if (sFileName[2] == '\\')
                {
                    sFileName = sFileName.Substring(4 - 1, sFileName.Length - 3);
                }
                sFileName = M2Share.g_Config.sEnvirDir + sFileName;
                if ((sType == "") || (sVarName == "") || !File.Exists(sFileName))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_SAVEVAR);
                    return;
                }
                boFoundVar = false;
                DynamicVarList = GetDynamicVarList(PlayObject, sType, ref sName);
                if (DynamicVarList == null)
                {
                    ScriptActionError(PlayObject, string.Format(sVarTypeError, new string[] { sType }), QuestActionInfo, M2Share.sSC_VAR);
                    return;
                }
                else
                {
                    IniFile = new IniFile(sFileName);
                    if (DynamicVarList.Count > 0)
                    {
                        for (int i = 0; i < DynamicVarList.Count; i++)
                        {
                            DynamicVar = DynamicVarList[i];
                            if (DynamicVar != null)
                            {
                                if ((DynamicVar.sName).ToLower().CompareTo((sVarName).ToLower()) == 0)
                                {
                                    switch (DynamicVar.VarType)
                                    {
                                        case TVarType.vInteger:
                                            IniFile.WriteInteger(sName, DynamicVar.sName, DynamicVar.nInternet);
                                            break;
                                        case TVarType.vString:
                                            IniFile.WriteString(sName, DynamicVar.sName, DynamicVar.sString);
                                            break;
                                    }
                                    boFoundVar = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (!boFoundVar)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sVarName, sType }), QuestActionInfo, M2Share.sSC_SAVEVAR);
                    }
                    Dispose(IniFile);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfSaveVar");
            }
        }

        // 对变量进行运算(+、-、*、/、=)
        private void ActionOfCalcVar(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            string sType;
            string sVarName;
            string sName = string.Empty;
            string sVarValue = string.Empty;
            string sVarValue2 = string.Empty;
            int nVarValue = 0;
            string sMethod = string.Empty;
            char cMethod;
            TDynamicVar DynamicVar;
            bool boFoundVar;
            IList<TDynamicVar> DynamicVarList;
            const string sVarFound = "变量%s不存在，变量类型:%s";
            const string sVarTypeError = "变量类型错误，错误类型:%s 当前支持类型(HUMAN、GUILD、GLOBAL)";
            try
            {
                sType = QuestActionInfo.sParam1;// 类型
                sVarName = QuestActionInfo.sParam2;// 自定义变量
                sMethod = QuestActionInfo.sParam3;// 操作符 +-*/=
                sVarValue = QuestActionInfo.sParam4;// 变量
                if ((sType == "") || (sVarName == "") || (sMethod == ""))
                {
                    ScriptActionError(PlayObject, "", QuestActionInfo, M2Share.sSC_CALCVAR);
                    return;
                }
                boFoundVar = false;
                if ((sVarValue != "") && (!HUtil32.IsStringNumber(sVarValue)))
                {
                    if (HUtil32.CompareLStr(sVarValue, "<$HUMAN(", 8))
                    {
                        HUtil32.ArrestStringEx(sVarValue, "(", ")", ref sVarValue2);
                        sVarValue = sVarValue2;
                        if (PlayObject.m_DynamicVarList.Count > 0)
                        {
                            for (int i = 0; i < PlayObject.m_DynamicVarList.Count; i++)
                            {
                                DynamicVar = PlayObject.m_DynamicVarList[i];
                                if ((DynamicVar.sName).ToLower().CompareTo((sVarValue).ToLower()) == 0)
                                {
                                    switch (DynamicVar.VarType)
                                    {
                                        case TVarType.vInteger:
                                            nVarValue = DynamicVar.nInternet;
                                            break;
                                        case TVarType.vString:
                                            sVarValue = DynamicVar.sString;
                                            break;
                                    }
                                    boFoundVar = true;
                                    break;
                                }
                            }
                        }
                        if (!boFoundVar)
                        {
                            ScriptActionError(PlayObject, string.Format(sVarFound, new string[] { sVarValue, sType }), QuestActionInfo, M2Share.sSC_CALCVAR);
                            return;
                        }
                    }
                    else
                    {
                        nVarValue = HUtil32.Str_ToInt(GetLineVariableText(PlayObject, sVarValue), 0);
                        sVarValue = GetLineVariableText(PlayObject, sVarValue);
                    }
                }
                else
                {
                    nVarValue = HUtil32.Str_ToInt(QuestActionInfo.sParam4, 0);
                }
                boFoundVar = false;
                cMethod = sMethod[1];
                DynamicVarList = GetDynamicVarList(PlayObject, sType, ref sName);
                if (DynamicVarList == null)
                {
                    ScriptActionError(PlayObject, string.Format(sVarTypeError, new string[] { sType }), QuestActionInfo, M2Share.sSC_CALCVAR);
                    return;
                }
                else
                {
                    if (DynamicVarList.Count > 0)
                    {
                        for (int i = 0; i < DynamicVarList.Count; i++)
                        {
                            DynamicVar = DynamicVarList[i];
                            if (DynamicVar != null)
                            {
                                if ((DynamicVar.sName).ToLower().CompareTo((sVarName).ToLower()) == 0)
                                {
                                    switch (DynamicVar.VarType)
                                    {
                                        case TVarType.vInteger:
                                            switch (cMethod)
                                            {
                                                case '=':
                                                    DynamicVar.nInternet = nVarValue;
                                                    break;
                                                case '+':
                                                    DynamicVar.nInternet = DynamicVar.nInternet + nVarValue;
                                                    break;
                                                case '-':
                                                    DynamicVar.nInternet = DynamicVar.nInternet - nVarValue;
                                                    break;
                                                case '*':
                                                    DynamicVar.nInternet = DynamicVar.nInternet * nVarValue;
                                                    break;
                                                case '/':
                                                    DynamicVar.nInternet = DynamicVar.nInternet / nVarValue;
                                                    break;
                                            }
                                            break;
                                        case TVarType.vString:
                                            switch (cMethod)
                                            {
                                                case '=':
                                                    DynamicVar.sString = sVarValue;
                                                    break;
                                                case '+':
                                                    DynamicVar.sString = DynamicVar.sString + sVarValue;
                                                    break;
                                                case '-':
                                                    break;
                                            }
                                            break;
                                    }
                                    boFoundVar = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (!boFoundVar)
                    {
                        ScriptActionError(PlayObject, string.Format(sVarFound, sVarName, sType), QuestActionInfo, M2Share.sSC_CALCVAR);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfCalcVar");
            }
        }

        /// <summary>
        /// 功能：改变英雄经络修炼点(打通一条经络后才有效)
        /// 格式：CHANGEHEROPULSEXP 控制符(+,-,=) 经验值
        /// </summary>
        private void ActionOfCHANGEHEROPULSEXP(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            char c1;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            c1 = QuestActionInfo.sParam1[1];
            if (PlayObject.m_MyHero != null)
            {
                switch (c1)
                {
                    case '+':
                        ((THeroObject)(PlayObject.m_MyHero)).m_nPulseExp = ((THeroObject)(PlayObject.m_MyHero)).m_nPulseExp + QuestActionInfo.nParam2;
                        break;
                    case '-':
                        ((THeroObject)(PlayObject.m_MyHero)).m_nPulseExp = ((THeroObject)(PlayObject.m_MyHero)).m_nPulseExp - QuestActionInfo.nParam2;
                        break;
                    case '=':
                        ((THeroObject)(PlayObject.m_MyHero)).m_nPulseExp = ((THeroObject)(PlayObject.m_MyHero)).m_nPulseExp;
                        break;
                }
            }
        }

        private void ActionOfOPENHEROPULS(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            if (PlayObject.m_MyHero != null)
            {
                ((THeroObject)(PlayObject.m_MyHero)).m_boisOpenPuls = true;
            }
        }


        private void ActionOfCHANGECATTLEGASEXP(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            // 富贵兽 
        }

        private void ActionOfCLOSECATTLEGAS(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            // 富贵兽 
        }

        private void ActionOfOPENCATTLEGAS(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            // 富贵兽 
        }

        private void ActionOfTAKEITMECOUNTDURA(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            // 给定物品持久命令 
        }

        // 查询双英雄数据
        private void ActionOfASSESSMENTHERO(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            try
            {
                if (QuestActionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PlayObject.SendMsg(PlayObject, Grobal2.RM_SHOWASSESSDLG, 0, 0, 0, 0, "");
                if ((PlayObject.m_sHeroCharName == "") && (PlayObject.m_boHasHero || PlayObject.m_boHasHeroTwo)) // 身上没有英雄才能取回
                {
                    M2Share.FrontEngine.AddToLoadHeroRcdList(PlayObject.m_sCharName, "", PlayObject, 7);
                }
                else
                {
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ActionOfASSESSMENTHERO");
            }
        }

        private void ActionOfOpenHeroAutoPractice(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            THeroDataInfo HeroData = null;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            if (!PlayObject.m_boHeroAutoTraining)
            {
                if (PlayObject.m_MyHero != null)
                {
                    if (((THeroObject)(PlayObject.m_MyHero)).m_btMentHero == 2)
                    {
                        HeroData.sChrName = ((THeroObject)(PlayObject.m_MyHero)).m_sCharName;
                        HeroData.Level = ((THeroObject)(PlayObject.m_MyHero)).m_Abil.Level;
                        HeroData.btSex = ((THeroObject)(PlayObject.m_MyHero)).m_btGender;
                        HeroData.btJob = ((THeroObject)(PlayObject.m_MyHero)).m_btJob;
                        HeroData.btType = ((THeroObject)(PlayObject.m_MyHero)).n_HeroTpye;
                        //PlayObject.SendMsg(PlayObject, Grobal2.RM_OPENTRAININGDLG, 0, 0, 0, 0, EDcode.Units.EDcode.EncodeBuffer(HeroData, sizeof(THeroDataInfo)));
                    }
                }
            }
        }

        private void ActionOfStopHeroAutoPractice(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            PlayObject.m_boHeroAutoTraining = false;
            PlayObject.SysMsg("副将英雄已停止修炼，召唤副将英雄后可以获得修炼过程中得到的经验和内功经验", TMsgColor.c_Blue, TMsgType.t_Hint);
        }


        private void ActionOfCHANGETRANPOINT(TPlayObject PlayObject, TQuestActionInfo QuestActionInfo)
        {
            char cMethod;
            TUserMagic UserMagic;
            if (QuestActionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(PlayObject, QuestActionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            cMethod = QuestActionInfo.sParam2[0];
            for (int i = 0; i < PlayObject.m_MagicList.Count; i++)
            {
                UserMagic = PlayObject.m_MagicList[i];
                if ((UserMagic != null) && ((UserMagic.MagicInfo.sDescr).ToLower().CompareTo((QuestActionInfo.sParam1).ToLower()) == 0))
                {
                    switch (cMethod)
                    {
                        case '=':
                            UserMagic.nTranPoint = QuestActionInfo.nParam3;
                            break;
                        case '-':
                            if (UserMagic.nTranPoint > QuestActionInfo.nParam3)
                            {
                                UserMagic.nTranPoint = UserMagic.nTranPoint - QuestActionInfo.nParam3;
                            }
                            else
                            {
                                UserMagic.nTranPoint = 0;
                            }
                            break;
                        case '+':
                            UserMagic.nTranPoint = UserMagic.nTranPoint + QuestActionInfo.nParam3;
                            break;
                    }
                }
            }
        }
    }
}
